d6b64c7e3ab9eb3e5391e18be6d846af34f31228
[platform/upstream/libnice.git] / scripts / lcov.mk
1
2 # ccache breaks -fprofile-arcs
3 export CCACHE_DISABLE=1
4
5 OUT=lcov
6
7 lcov-clean:
8         $(MAKE) clean
9         find -name "*.gcno" -o -name "*.gcda" -exec rm '{}' ';'
10         rm -rf $(OUT)
11
12 lcov-build:
13         $(MAKE) CFLAGS="-O0 -fprofile-arcs -ftest-coverage" LDFLAGS="-lgcov" check
14
15 lcov-report:
16         # hack: move gcov file from libraries back to source directory
17         for dir in `find -name .libs`; do \
18                 (cd `dirname $$dir`; mv .libs/*.gc?? . || true) 2>/dev/null; \
19         done
20
21         mkdir -p $(OUT)
22         lcov -d . -c >$(OUT)/lcov.info 2>/dev/null
23         lcov -l $(OUT)/lcov.info 2>/dev/null |\
24                 egrep '(^/usr|/test.*\.c)' |\
25                 cut -d: -f1 >$(OUT)/lcov.remove
26         lcov -r $(OUT)/lcov.info `cat $(OUT)/lcov.remove` 2>/dev/null >$(OUT)/lcov.info.clean
27         genhtml -o lcov $(OUT)/lcov.info.clean
28