py make allow options to build_ext
[sddekit.git] / makefile
blob24064468886f17895a1553ded184afc0924a71e7
1 CC=gcc
2 CFLAGS=-g -std=c99 -Isrc -Wall -Wextra -DSDDEBUG
3 LDFLAGS=-lm
5 # e.g. -pg -fprofile-arcs -ftest-coverage
6 CFLAGS += $(EXTRA_CFLAGS)
8 # TODO provide alternatives for Windows
9 test_list_maker=./make_test_list.sh
11 test: libobjects run_tests
12 ./run_tests
14 memtest: libobjects run_tests
15 valgrind --error-exitcode=1 --track-origins=yes --leak-check=full ./run_tests
17 bench: libobjects $(patsubst bench/%.c,%,$(wildcard bench/*.c))
19 libobjects: $(patsubst src/%.c,%.o,$(wildcard src/*.c))
21 run_tests: libobjects $(patsubst test/%.c,%.o,$(wildcard test/test_*.c))
22 $(CC) $(CFLAGS) -I./ test/main.c *.o -o run_tests $(LDFLAGS)
24 valgrind: run_tests
25 valgrind --leak-check=full --track-origins=yes ./run_tests &> val.out ; vim val.out
27 gdb: run_tests
28 gdb run_tests
30 gdbtest: run_tests
31 gdb run_tests -ex 'b sd_test_failed' -ex 'r'
33 %.o: src/%.c
34 $(CC) $(CFLAGS) -c $< $(LDFLAGS)
36 %.o: test/%.c
37 $(CC) $(CFLAGS) -c $< $(LDFLAGS)
39 %: bench/%.c
40 $(CC) $(CFLAGS) $< *.o $(LDFLAGS)
42 bench_%: bench/bench_%.c
43 $(CC) $(CFLAGS) $< *.o -o bench_$* $(LDFLAGS)
45 clean:
46 rm -f *.o test_list.h sddekit.h.gch *.gcda *.gcno gmon.out *.c.gcov val.out run_tests *.dat