1## .PHONY so it always rebuilds it
2.PHONY: lcov-reset lcov lcov-run lcov-report lcov-upload lcov-clean
3
4# run lcov from scratch, always
5lcov-reset:
6	$(MAKE) lcov-run
7	$(MAKE) lcov-report
8
9# run lcov from scratch if the dir is not there
10lcov:
11	$(MAKE) lcov-reset
12
13if GST_GCOV_ENABLED
14# reset lcov stats
15lcov-clean:
16	@-rm -rf lcov
17	lcov --directory . --zerocounters
18
19# reset run coverage tests
20lcov-run:
21	-$(MAKE) lcov-clean
22	-if test -d tests/check; then $(MAKE) -C tests/check inspect; fi
23	-$(MAKE) check
24
25# generate report based on current coverage data
26lcov-report:
27	mkdir lcov
28	lcov --compat-libtool --directory . --capture --output-file lcov/lcov.info
29	lcov --list-full-path -l lcov/lcov.info | grep -v "`cd $(top_srcdir) && pwd`" | cut -d\| -f1 > lcov/remove
30	lcov --list-full-path -l lcov/lcov.info | grep "tests/check/" | cut -d\| -f1 >> lcov/remove
31	lcov --list-full-path -l lcov/lcov.info | grep "docs/plugins/" | cut -d\| -f1 >> lcov/remove
32	lcov -r lcov/lcov.info `cat lcov/remove` > lcov/lcov.cleaned.info
33	rm lcov/remove
34	mv lcov/lcov.cleaned.info lcov/lcov.info
35	genhtml -t "$(PACKAGE_STRING)" -o lcov --num-spaces 2 lcov/lcov.info
36
37lcov-upload: lcov
38	rsync -rvz -e ssh --delete lcov/* gstreamer.freedesktop.org:/srv/gstreamer.freedesktop.org/www/data/coverage/lcov/$(PACKAGE)
39
40else
41lcov-run:
42	echo "Need to reconfigure with --enable-gcov"
43
44lcov-report:
45	echo "Need to reconfigure with --enable-gcov"
46endif
47
48