X-Git-Url: http://git.squeep.com/?p=reservoir_sample;a=blobdiff_plain;f=Makefile;fp=Makefile;h=2762a295d5cbbc2d71624205d182f0ce39134b17;hp=0000000000000000000000000000000000000000;hb=694d004f3c2a521672d468a8bc77dc2b635ffd9f;hpb=6bd502bb5a3c61bb3b0cd76d613973346e8a5d90 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2762a29 --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ +#!make + +ifeq "$(origin CC)" "default" +CC = clang +endif + +CFLAGS += -g -Wall -Wextra +#CPPFLAGS += -DNDEBUG +LDFLAGS += + +MAKEDEPEND = $(CC) -MM + +TARGETS = reservoir_sample +TEST_DIR = test +TESTS = $(addprefix $(TEST_DIR)/, reservoir_sample_test) +SOURCES = reservoir_sample.c notify.c +OBJECTS = $(SOURCES:.c=.o) +TEST_OBJECTS = $(TESTS:=.o) test_suite.o + +.PHONY: all test check clean + +all: $(TARGETS) .depend + +version.h: + ./version.sh 0 0 prototype + +.depend: $(SOURCES) version.h + $(MAKEDEPEND) $(CPPFLAGS) $^ > $@ + +clean: + @rm -rf $(TARGETS) $(TESTS) $(TEST_OBJECTS) $(OBJECTS) *.dSYM .depend core + +test: $(TESTS) $(TARGETS) + + +check: test + @for t in $(TESTS); do \ + echo Checking $${t};\ + ./$${t} > /dev/null || echo -- $${t} FAILED --;\ + done + +$(TEST_DIR)/%_test.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) -DTEST -c -o $@ $< + +$(TEST_DIR)/reservoir_sample_test: %: %.o test_suite.o notify.o + +reservoir_sample: %: %.o notify.o + +-include .depend