2 CFLAGS
=-g
-std
=c99
-Isrc
-Wall
-Wextra
-DSDDEBUG
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
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
)
25 valgrind
--leak-check
=full
--track-origins
=yes .
/run_tests
&> val.out
; vim val.out
31 gdb run_tests
-ex
'b sd_test_failed' -ex
'r'
34 $(CC
) $(CFLAGS
) -c
$< $(LDFLAGS
)
37 $(CC
) $(CFLAGS
) -c
$< $(LDFLAGS
)
40 $(CC
) $(CFLAGS
) $< *.o
$(LDFLAGS
)
42 bench_
%: bench
/bench_
%.c
43 $(CC
) $(CFLAGS
) $< *.o
-o bench_
$* $(LDFLAGS
)
46 rm -f
*.o test_list.h sddekit.h.gch
*.gcda
*.gcno gmon.out
*.c.gcov val.out run_tests
*.dat