VERSION = \"$(shell git describe --tags --dirty)\" CC=gcc IFLAGS = -I. LFLAGS = -lm CFLAGS = -Wall -Werror --std=c99 -pedantic $(IFLAGS) -D_DEFAULT_SOURCE -DVERSION=${VERSION} LDFLAGS = $(LFLAGS) PREFIX = /usr/local OBJ_BIN = src/opendeco.o src/opendeco-cli.o src/opendeco-conf.o src/deco.o src/output.o src/schedule.o toml/toml.o OBJ_LIB = src/deco.o src/output.o src/schedule.o OBJ_TST = test/opendeco_test.o test/deco_test.o src/deco.o minunit/minunit.o LICENSES = minunit/LICENSE.h toml/LICENSE.h DEPS = $(shell find -type f -name "*.dep") all: opendeco opendeco_test libopendeco.a run: opendeco ./opendeco -d 30 -t 120 -g EAN32 --decogasses EAN50 test: opendeco_test ./opendeco_test lib: libopendeco.a install: opendeco mkdir -p ${DESTDIR}${PREFIX}/bin cp -f opendeco ${DESTDIR}${PREFIX}/bin chmod 755 ${DESTDIR}${PREFIX}/bin/opendeco uninstall: rm -f ${DESTDIR}${PREFIX}/bin/opendeco opendeco: $(OBJ_BIN) @echo " LD $@" @$(CC) -o opendeco $(OBJ_BIN) $(LDFLAGS) opendeco_test: $(OBJ_TST) @echo " LD $@" @$(CC) -o opendeco_test $(OBJ_TST) $(LDFLAGS) libopendeco.a: $(OBJ_LIB) @echo " AR $@" @ar rs libopendeco.a $(OBJ_LIB) %.o: %.c @echo " CC $@" @mkdir -p .dep/$(dir $@) @$(CC) $(CFLAGS) -MMD -MF .dep/$@.dep -o $@ -c $< # generate LICENSES.h files for --licenses src/opendeco-cli.o: $(LICENSES) %LICENSE.h: %LICENSE @echo " XXD $@" @xxd -i $< > $@ clean: rm -f $(OBJ_BIN) rm -f $(OBJ_LIB) rm -f $(OBJ_TST) rm -f $(LICENSES) rm -f opendeco rm -f opendeco_test rm -f libopendeco.a rm -rf .dep -include $(DEPS) .PHONY: all run test lib install uninstall clean