1#
2# Generate lcov output
3#
4
5#
6# Copyright (C) 2007 Nokia Corporation
7# Contact: Pekka Pessi <pekka.pessi@nokia.com>
8# Licensed under LGPL. See file COPYING.
9#
10
11# Scripts
12LCOV_UNCOVERED=${top_srcdir}/scripts/uncovered
13LCOV_REPORT=${top_srcdir}/scripts/lcov-report
14
15# Report directory
16lcovdir=${top_builddir}/lcov
17
18# Options
19GENHTML_OPTIONS = --show-details --legend
20if HAVE_GENPNG
21GENHTML_OPTIONS += --frames
22endif
23
24# Fancy shell command that expands to directory relative to top_builddir
25expand_subdir=`pwd|sed "s'\`cd ${top_builddir};pwd\`''"`
26
27#
28# Generate pretty coverage report (unless it has been already done)
29#
30lcov:
31	@-test -r ${lcovdir}${expand_subdir}/lcov.info \
32	|| make lcov-report
33
34# Generate pretty coverage report based on current coverage data
35lcov-report:
36	sub=${expand_subdir} odir=${lcovdir}$$sub ; \
37	rm -rf $$odir ; mkdir -p $$odir && \
38	${LCOV_REPORT} ${GENHTML_OPTIONS} \
39          --title "${PACKAGE_NAME}-${PACKAGE_VERSION}$$sub" \
40	  --srcdir=${srcdir} -o $$odir
41
42# Rerun checks before generating report
43lcov-rerun: clean-lcov
44	$(MAKE) $(AM_MAKEFLAGS) check
45	$(MAKE) $(AM_MAKEFLAGS) lcov-report
46
47# Show all uncovered lines as errors
48uncovered:
49	${LCOV_UNCOVERED} --lcov-dir=${lcovdir} --srcdir=${srcdir}
50
51# Run check in current dir and show all uncovered lines as errors
52covcheck:
53	-find . -name "*.gcda" | xargs rm -rf
54	$(MAKE) $(AM_MAKEFLAGS) check
55	${LCOV_UNCOVERED} --lcov-dir=${lcovdir} --srcdir=${srcdir}
56
57clean-local::
58	-rm -rf ${lcovdir}`pwd|sed "s'\`cd ${top_builddir};pwd\`''"`
59	find . -name "*.gcda" | xargs rm -f || true
60
61clean-lcov:
62	-rm -rf ${lcovdir}`pwd|sed "s'\`cd ${top_builddir};pwd\`''"`
63	find . -name "*.gcda" | xargs rm -f || true
64
65PHONY += lcov lcov-report lcov-rerun clean-lcov covcheck uncovered
66