-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
64 lines (46 loc) · 1.48 KB
/
GNUmakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
LIB_OBJS = yocton.o yoctonw.o
TEST_OBJS = yocton.test.o yocton_test.test.o alloc-testing.test.o
GCOV_OBJS = $(subst .test.o,.gcov.o,$(TEST_OBJS))
CFLAGS = -Wall -Wc++-compat
TEST_CFLAGS = $(CFLAGS) -g -DALLOC_TESTING
GCOV_CFLAGS = $(TEST_CFLAGS) -fprofile-arcs -ftest-coverage
IWYU = iwyu
IWYU_FLAGS = --error --mapping_file=.iwyu-overrides.imp
IWYU_TRANSFORMED_FLAGS = $(patsubst %,-Xiwyu %,$(IWYU_FLAGS)) $(CFLAGS)
all: yocton_print yocton_test
check: yocton_test
./yocton_test tests/*
./yocton_test.py
coverage : yocton.c.gcov
%.c.gcov: %.gcov.gcda
gcov $<
%.gcov.gcda : yocton_test_gcov
rm -f yocton.gcov.gcda
./yocton_test_gcov tests/*
docs: html/index.html
html/index.html: $(wildcard *.h *.md) Doxyfile
doxygen
yocton_print : yocton_print.o $(LIB_OBJS)
$(CC) $(LDFLAGS) $^ -o $@
yocton_test : $(TEST_OBJS)
$(CC) $(TEST_CFLAGS) $(LDFLAGS) $^ -o $@
yocton_test_gcov : $(GCOV_OBJS)
$(CC) $(GCOV_CFLAGS) $(LDFLAGS) $^ -o $@
%.o : %.c
$(CC) -c $(CFLAGS) $< -o $@
%.gcov.o : %.c
$(CC) -c $(GCOV_CFLAGS) $< -o $@
%.test.o : %.c
$(CC) -c $(TEST_CFLAGS) $< -o $@
fixincludes:
for d in *.c; do \
$(IWYU) $(IWYU_TRANSFORMED_FLAGS) 2>&1 $$d | fix_include; \
done
clean:
rm -f yocton_print $(LIB_OBJS) \
yocton_test $(TEST_OBJS) \
yocton_test_gcov $(GCOV_OBJS) \
$(subst .gcov.o,.gcov.gcno,$(GCOV_OBJS)) \
$(subst .gcov.o,.c.gcov,$(GCOV_OBJS)) \
$(subst .gcov.o,.gcov.gcda,$(GCOV_OBJS))
.PHONY: clean fixincludes docs all check coverage