Merge branch 'release-1.0' into develop
[reservoir_sample] / Makefile
1 #!make
2
3 ifeq "$(origin CC)" "default"
4 CC = clang
5 endif
6
7 CFLAGS += -g -Wall -Wextra
8 #CPPFLAGS += -DNDEBUG
9 LDFLAGS +=
10
11 MAKEDEPEND = $(CC) -MM
12
13 TARGETS = reservoir_sample
14 TEST_DIR = test
15 TESTS = $(addprefix $(TEST_DIR)/, reservoir_sample_test)
16 SOURCES = reservoir_sample.c notify.c
17 OBJECTS = $(SOURCES:.c=.o)
18 TEST_OBJECTS = $(TESTS:=.o) test_suite.o
19
20 .PHONY: all test check clean
21
22 all: $(TARGETS) .depend
23
24 version.h:
25 ./version.sh 0 0 prototype
26
27 .depend: $(SOURCES) version.h
28 $(MAKEDEPEND) $(CPPFLAGS) $^ > $@
29
30 clean:
31 @rm -rf $(TARGETS) $(TESTS) $(TEST_OBJECTS) $(OBJECTS) *.dSYM .depend core
32
33 test: $(TESTS) $(TARGETS)
34
35
36 check: test
37 @for t in $(TESTS); do \
38 echo Checking $${t};\
39 ./$${t} > /dev/null || echo -- $${t} FAILED --;\
40 done
41
42 $(TEST_DIR)/%_test.o: %.c
43 $(CC) $(CFLAGS) $(CPPFLAGS) -DTEST -c -o $@ $<
44
45 $(TEST_DIR)/reservoir_sample_test: %: %.o test_suite.o notify.o
46
47 reservoir_sample: %: %.o notify.o
48
49 -include .depend