fix coverage creation

This commit is contained in:
Steffen Jaeckel 2017-09-13 17:46:41 +02:00
parent e7fc79309e
commit 8bb0855e74

View File

@ -17,6 +17,13 @@ else
silent=@ silent=@
endif endif
ifeq ($(COVERAGE),1)
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lgcov
LIB_PRE = -Wl,--whole-archive
LIB_POST = -Wl,--no-whole-archive
endif
%.o: %.c %.o: %.c
ifneq ($V,1) ifneq ($V,1)
@echo " * ${CC} $@" @echo " * ${CC} $@"
@ -66,13 +73,13 @@ uninstall: .common_uninstall
.PHONY: test .PHONY: test
test: $(LIBNAME) demo/test.o test: $(LIBNAME) demo/test.o
$(CC) $(CFLAGS) demo/test.o $(LIBNAME) $(PROF) -o test $(CC) $(CFLAGS) demo/test.o $(LIB_PRE) $(LIBNAME) $(LIB_POST) $(PROF) -o test
test_standalone: CFLAGS+=-DTFM_DEMO_TEST_VS_MTEST=0 test_standalone: CFLAGS+=-DTFM_DEMO_TEST_VS_MTEST=0
.PHONY: test_standalone .PHONY: test_standalone
test_standalone: $(LIBNAME) demo/test.o test_standalone: $(LIBNAME) demo/test.o
$(CC) $(CFLAGS) demo/test.o $(LIBNAME) $(PROF) -o test $(CC) $(CFLAGS) demo/test.o $(LIB_PRE) $(LIBNAME) $(LIB_POST) $(PROF) -o test
testme: test mtest testme: test mtest
./mtest/mtest -15 | ./test ./mtest/mtest -15 | ./test
@ -115,8 +122,7 @@ coverage: LDFLAGS += -lgcov
coverage: LIB_PRE = -Wl,--whole-archive coverage: LIB_PRE = -Wl,--whole-archive
coverage: LIB_POST = -Wl,--no-whole-archive coverage: LIB_POST = -Wl,--no-whole-archive
coverage: coverage: testme
$(MAKE) testme
$(MAKE) lcov-single $(MAKE) lcov-single
stest: $(LIBNAME) demo/stest.o stest: $(LIBNAME) demo/stest.o