DAEMONS = cache metadatadb automalua TESTER = updateKV metadatadbTester PROGS = $(DAEMONS) $(TESTER) SERVICES = $(DAEMONS:%=xaal-%.service) CFLAGS = -Wall -I. -g -O0 LDLIBS = -L. -lxaal -lcbor -ljson-c -luuid -lsodium all: $(PROGS) schemory: schemory.c $(LINK.c) $^ $(LOADLIBES) -lcurl $(LDLIBS) -o $@ metadatadb: metadatadb.c $(LINK.c) $^ $(LOADLIBES) -lsqlite3 $(LDLIBS) -o $@ automalua: automalua.c $(LINK.c) $^ $(LOADLIBES) -llua5.2 $(LDLIBS) -o $@ clean: -rm -f *.o *~ proper: clean -rm -f $(PROGS) $(SERVICES) SHELL = /bin/bash test: all @echo " " You can test $(PROGS) @echo " " First, do: export LD_LIBRARY_PATH+=:. @echo " " Then, eg.: @/bin/echo -e "" $(foreach i,$(PROGS)," ./$(i) -a 224.0.29.200 -p 1236 -s my_secret\n") Makefile.dep: $(PROGS:=.c) $(CC) $(CFLAGS) -MM $^ > $@ include Makefile.dep .PHONY: all clean proper install uninstall test test2 svnignore .SUFFIXES: .service .service.in .svnignore: echo $(PROGS) $(PROGS:=.o) $(SERVICES) metadata.db | tr ' ' '\012' > $@ svnignore: .svnignore svn propset svn:ignore -F $< . install: $(DAEMONS) $(SERVICES) sudo systemctl --system --now enable $(SERVICES:%=$(PWD)/%) xaal-%.service: %.service.in envsubst < $< > $@ uninstall: -$(foreach i,$(SERVICES),\ if systemctl --system --quiet is-enabled $(i) &>/dev/null ; then \ sudo systemctl --system --now disable $(i); \ fi;) status: -sudo systemctl --system --no-pager -l status $(SERVICES)