Add lcov.mk, copied from telepathy-glib:
http://cgit.freedesktop.org/telepathy/telepathy-glib/tree/tools/lcov.am
with the tp-glib–specific bits removed.
These targets are only useful if folks is compiled with
--enable-code-coverage.
To run the test suite and generate a report, run `make lcov-check`. To just
generate a report without running the test suite, run `make lcov-report`.
The .info file and generated report are only deleted by
`make maintainer-clean`, since the developer might want to refer to them
across other cleans.
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=659610
EXTRA_DIST = \
autogen.sh \
check.mk \
+ lcov.mk \
valgrind.mk \
$(NULL)
MAINTAINERCLEANFILES = \
ABOUT-NLS \
+ $(top_builddir)/lcov.info \
$(srcdir)/INSTALL \
$(srcdir)/aclocal.m4 \
$(srcdir)/compile \
po/remove-potcdate.sin \
$(NULL)
+maintainer-clean-local: maintainer-clean-local-lcov
+maintainer-clean-local-lcov:
+ rm -rf $(top_builddir)/lcov.html
+
+.PHONY: maintainer-clean-local-lcov
+
+GITIGNOREFILES = \
+ $(top_builddir)/lcov.html/* \
+ $(NULL)
+
distclean-local:
if test "x$(srcdir)" = "x."; then :; else \
rm -f ChangeLog; \
.PHONY: ChangeLog
+# Code coverage support
+include lcov.mk
+
-include $(top_srcdir)/git.mk
--- /dev/null
+# From http://cgit.freedesktop.org/telepathy/telepathy-glib/tree/tools/lcov.am
+
+lcov-reset:
+ lcov --directory @top_srcdir@ --zerocounters
+
+lcov-report:
+ lcov --directory @top_srcdir@ --capture \
+ --output-file @top_builddir@/lcov.info
+ $(mkdir_p) @top_builddir@/lcov.html
+ git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`;\
+ genhtml --title "@PACKAGE_STRING@ $$git_commit" \
+ --output-directory @top_builddir@/lcov.html lcov.info
+ @echo
+ @echo 'lcov report can be found in:'
+ @echo 'file://@abs_top_builddir@/lcov.html/index.html'
+ @echo
+
+lcov-check:
+ $(MAKE) lcov-reset
+ $(MAKE) check $(LCOV_CHECK_ARGS)
+ $(MAKE) lcov-report
+
+## vim:set ft=automake: