2024-08-01 21:35:35 +02:00
|
|
|
# sci - simple continuous integration
|
|
|
|
# See LICENSE file for copyright and license details.
|
|
|
|
# Note: If you're confused by the makefile, I do emplore you to read the info-page: $ info make
|
|
|
|
.POSIX:
|
2024-08-06 20:35:00 +02:00
|
|
|
|
2024-08-01 21:35:35 +02:00
|
|
|
NAME=sci
|
2024-08-02 19:11:12 +02:00
|
|
|
DESCRIPTION=$(NAME) is a simple contiuous integration system.
|
2024-08-06 20:35:00 +02:00
|
|
|
VERSION = 1.0.0
|
2024-08-18 20:22:06 +02:00
|
|
|
PREFIX ?= /usr/local
|
2024-08-06 20:35:00 +02:00
|
|
|
MANPREFIX = $(PREFIX)/share/man
|
|
|
|
|
2024-08-02 19:11:12 +02:00
|
|
|
CC = gcc
|
2024-08-01 21:35:35 +02:00
|
|
|
OUTDIR := out/
|
|
|
|
OBJDIR := out/obj
|
|
|
|
BINDIR := out/bin
|
2024-08-02 19:11:12 +02:00
|
|
|
CFLAGS += -DSCI_VERSION="\"$(VERSION)\""
|
|
|
|
CFLAGS += -DSCI_NAME="\"$(NAME)\""
|
|
|
|
CFLAGS += -DSCI_DESCRIPTION="\"$(DESCRIPTION)\""
|
2024-08-03 13:08:46 +02:00
|
|
|
CFLAGS += -D_POSIX_C_SOURCE=2
|
|
|
|
CFLAGS += -D_GNU_SOURCE
|
2024-08-06 20:35:00 +02:00
|
|
|
CFLAGS += -Wall -Werror -std=c11 -g
|
2024-08-02 19:11:12 +02:00
|
|
|
CFLAGS += -Iinclude
|
2024-08-06 19:13:28 +02:00
|
|
|
CFLAGS += -lpthread -luuid
|
2024-08-01 21:35:35 +02:00
|
|
|
|
2024-08-06 20:35:00 +02:00
|
|
|
.PHONY: all clean dist install
|
2024-08-01 21:35:35 +02:00
|
|
|
|
|
|
|
all: out/bin/sci
|
|
|
|
|
|
|
|
out/obj/%.o: src/%.c | $(OBJDIR)
|
|
|
|
$(CC) -c $? $(CFLAGS) -o $@
|
|
|
|
|
2024-08-02 19:11:12 +02:00
|
|
|
OBJ += out/obj/main.o
|
|
|
|
OBJ += out/obj/cli.o
|
2024-08-03 09:21:21 +02:00
|
|
|
OBJ += out/obj/log.o
|
2024-08-02 19:11:12 +02:00
|
|
|
OBJ += out/obj/notify.o
|
2024-08-03 13:08:46 +02:00
|
|
|
OBJ += out/obj/util.o
|
|
|
|
OBJ += out/obj/pipeline.o
|
|
|
|
OBJ += out/obj/threadlist.o
|
|
|
|
OBJ += out/obj/threadpool.o
|
2024-08-02 19:11:12 +02:00
|
|
|
out/bin/sci: $(OBJ) | $(BINDIR)
|
2024-08-18 20:22:06 +02:00
|
|
|
$(CC) -o $@ $^ $(CFLAGS)
|
2024-08-01 21:35:35 +02:00
|
|
|
|
|
|
|
clean:
|
2024-08-02 19:11:12 +02:00
|
|
|
rm -rf $(OUTDIR)
|
2024-08-06 20:35:00 +02:00
|
|
|
rm -rf $(NAME)-$(VERSION)
|
2024-08-01 21:35:35 +02:00
|
|
|
|
|
|
|
$(OUTDIR):
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
$(OBJDIR): $(OUTDIR)
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
$(BINDIR): $(OUTDIR)
|
|
|
|
mkdir -p $@
|
|
|
|
|
2024-08-06 20:35:00 +02:00
|
|
|
dist:
|
|
|
|
mkdir -p $(NAME)-$(VERSION)
|
|
|
|
cp -R \
|
|
|
|
TODO.md README.md\
|
2024-08-23 18:17:39 +02:00
|
|
|
Makefile src include scripts\
|
2024-08-06 20:35:00 +02:00
|
|
|
$(NAME)-$(VERSION)
|
|
|
|
tar -cf - $(NAME)-$(VERSION) | gzip > $(NAME)-$(VERSION).tar.gz
|
|
|
|
rm -rf $(NAME)-$(VERSION)
|
|
|
|
|
|
|
|
# NOTE: DESTDIR is meant for making packaging easier.
|
|
|
|
# If you want to install in a different directory than the default, please
|
|
|
|
# use: # make install PREFIX=/custom/path
|
|
|
|
install: out/bin/sci
|
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
2024-08-23 18:17:39 +02:00
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/etc/sci
|
2024-08-06 20:35:00 +02:00
|
|
|
# install binaries
|
|
|
|
cp -f out/bin/sci $(DESTDIR)$(PREFIX)/bin
|
|
|
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/sci
|
|
|
|
# install libraries
|
2024-08-23 18:17:39 +02:00
|
|
|
# install extras
|
|
|
|
cp -r scripts $(DESTDIR)$(PREFIX)/etc/sci/
|
2024-08-06 20:35:00 +02:00
|
|
|
# install services (only if system is using systemd though)
|
|
|
|
# install manpages
|
|
|
|
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
|
|
|
sed "s/VERSION/$(VERSION)/g" < src/sci.1 > $(DESTDIR)$(MANPREFIX)/man1/sci.1
|
|
|
|
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sci.1
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
# uninstall binaries
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/sci
|
|
|
|
# uninstall libraries
|
|
|
|
# uninstall services (only if system is using systemd though)
|
|
|
|
# uninstall manpages
|
|
|
|
rm -f $(DESTDIR)$(MANPREFIX)/man1/sci.1
|