2 # when included in a Makefile it builds *.c unless SRCS are overridden
4 # default TROOT works from src/*/Makefile
6 SRCS ?= $(sort $(wildcard *.c))
12 CFLAGS += -g -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE -std=c99 -pipe -Wall -Wno-unused-function -Wno-missing-braces
13 LDFLAGS += -g -lpthread -lrt -lm
15 include $(TROOT)/config.mak
17 CFLAGS += -I$(TROOT)/common
25 rm -f $(OBJS) t t_.o b b_.o tests.a tests.h
28 $(CC) $(CFLAGS) -c -o $@ $<
30 $(OBJS): $(TROOT)/common/test.h $(TROOT)/config.mak
33 nm -f posix $+ |awk ' \
34 /^test/ && $$2=="T"{print "T(" $$1 ")"} \
35 /^bench/ && $$2=="T"{print "B(" $$1 ")"} \
43 t_.o: $(TROOT)/common/t.c $(TROOT)/common/test.h tests.h
44 $(CC) $(CFLAGS) -I. -c -o $@ $<
47 $(CC) $+ $(LDFLAGS) -o $@
49 b_.o: $(TROOT)/common/b.c $(TROOT)/common/test.h tests.h
50 $(CC) $(CFLAGS) -I. -c -o $@ $<
53 $(CC) $+ $(LDFLAGS) -lrt -o $@
55 .PHONY: all clean test