lcov.am 1.71 KB
Newer Older
1
#
Pekka Pessi's avatar
Pekka Pessi committed
2
# Generate lcov output
3
#
Pekka Pessi's avatar
Pekka Pessi committed
4 5 6 7 8

#
# Copyright (C) 2007 Nokia Corporation
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
# Licensed under LGPL. See file COPYING.
9 10
#

Pekka Pessi's avatar
Pekka Pessi committed
11 12 13
# Scripts
LCOV_UNCOVERED=${top_srcdir}/scripts/uncovered
LCOV_REPORT=${top_srcdir}/scripts/lcov-report
14

Pekka Pessi's avatar
Pekka Pessi committed
15 16
# Report directory
lcovdir=${top_builddir}/lcov
17

Pekka Pessi's avatar
Pekka Pessi committed
18 19
# Options
GENHTML_OPTIONS = --show-details --legend
20
if HAVE_GENPNG
Pekka Pessi's avatar
Pekka Pessi committed
21
GENHTML_OPTIONS += --frames
22 23
endif

Pekka Pessi's avatar
Pekka Pessi committed
24 25
# Fancy shell command that expands to directory relative to top_builddir
expand_subdir=`pwd|sed "s'\`cd ${top_builddir};pwd\`''"`
26 27

#
Pekka Pessi's avatar
Pekka Pessi committed
28
# Generate pretty coverage report (unless it has been already done)
29
#
Pekka Pessi's avatar
Pekka Pessi committed
30 31 32 33 34
lcov:
	@-test -r ${lcovdir}${expand_subdir}/lcov.info \
	|| make lcov-report

# Generate pretty coverage report based on current coverage data
35
lcov-report:
Pekka Pessi's avatar
Pekka Pessi committed
36 37 38 39
	sub=${expand_subdir} odir=${lcovdir}$$sub ; \
	rm -rf $$odir ; mkdir -p $$odir && \
	${LCOV_REPORT} ${GENHTML_OPTIONS} \
          --title "${PACKAGE_NAME}-${PACKAGE_VERSION}$$sub" \
40
	  --srcdir=${srcdir} -o $$odir
Pekka Pessi's avatar
Pekka Pessi committed
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56

# Rerun checks before generating report
lcov-rerun: clean-lcov
	$(MAKE) $(AM_MAKEFLAGS) check
	$(MAKE) $(AM_MAKEFLAGS) lcov-report

# Show all uncovered lines as errors
uncovered:
	${LCOV_UNCOVERED} --lcov-dir=${lcovdir} --srcdir=${srcdir}

# Run check in current dir and show all uncovered lines as errors
covcheck:
	-find . -name "*.gcda" | xargs rm -rf
	$(MAKE) $(AM_MAKEFLAGS) check
	${LCOV_UNCOVERED} --lcov-dir=${lcovdir} --srcdir=${srcdir}

Pekka Pessi's avatar
Pekka Pessi committed
57 58 59
clean-local::
	-rm -rf ${lcovdir}`pwd|sed "s'\`cd ${top_builddir};pwd\`''"`
	find . -name "*.gcda" | xargs rm -f || true
Pekka Pessi's avatar
Pekka Pessi committed
60 61 62 63

clean-lcov:
	-rm -rf ${lcovdir}`pwd|sed "s'\`cd ${top_builddir};pwd\`''"`
	find . -name "*.gcda" | xargs rm -f || true
64

Pekka Pessi's avatar
Pekka Pessi committed
65
PHONY += lcov lcov-report lcov-rerun clean-lcov covcheck uncovered