OUT=libscomp.a VERSION=0.1.0 TESTS=test/input test/exec all: $(OUT) libscomp_amalg.c libscomp_amalg.h $(OUT): input.o exec.o $(AR) rcs $(OUT) input.o exec.o tests: $(TESTS) for i in $(TESTS); do ./$$i -v; done libscomp_amalg.h: exec.h input.h echo '#pragma once' > libscomp_amalg.h echo '#define LIBSCOMP_VERSION "${VERSION}"' >> libscomp_amalg.h cat input.h exec.h | \ sed 's/#pragma .*//g; s/#include ".*//g' \ >> libscomp_amalg.h libscomp_amalg.c: exec.c input.c echo '#include "libscomp_amalg.h"' > libscomp_amalg.c cat exec.c input.c | sed 's/#include ".*//g' \ >> libscomp_amalg.c TEST_EXEC=test/exec.o exec.o test/exec: $(TEST_EXEC) $(CC) -Wall $(TEST_EXEC) -o test/exec TEST_INPUT=test/input.o input.o test/input: $(TEST_INPUT) $(CC) -Wall $(TEST_INPUT) -o test/input .c.o: $(CC) -g -std=c89 -Wall -c $< -o $@ clean: $(RM) $(TESTS) $(OUT) *.o