summaryrefslogtreecommitdiff
path: root/scripts/lcov.mk
blob: 665a7dd6b11b46b5090bad7df0f6a253e908c1f7 (plain)
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

# ccache breaks -fprofile-arcs
export CCACHE_DISABLE=1

OUT=lcov

all : lcov-build

lcov-clean:
	find -name "*.gcno" -o -name "*.gcda" -exec rm '{}' ';'
	rm -rf $(OUT)

lcov-build:
	$(MAKE) CFLAGS="-O0 -fprofile-arcs -ftest-coverage" LDFLAGS="-lgcov" check

lcov-report:
	: # hack: move gcov file from libraries back to source directory
	for dir in `find -name .libs`; do \
		(cd `dirname $$dir`; mv .libs/*.gc?? . || true) 2>/dev/null; \
	done

	mkdir -p $(OUT)
	lcov -d . -c >$(OUT)/lcov.info 2>/dev/null
	lcov -l $(OUT)/lcov.info 2>/dev/null |\
		egrep '(^/usr|/test.*\.c|signals-marshal)' |\
		cut -d: -f1 >$(OUT)/lcov.remove
	lcov -r $(OUT)/lcov.info `cat $(OUT)/lcov.remove` 2>/dev/null >$(OUT)/lcov.info.clean
	genhtml -o lcov $(OUT)/lcov.info.clean