[folks] build: Add lcov make targets from telepathy-glib



commit 4acfe29de66deff09e778084dae2d9f39fdbf28e
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Jan 8 23:16:14 2012 +0000

    build: Add lcov make targets from telepathy-glib
    
    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

 Makefile.am |   15 +++++++++++++++
 lcov.mk     |   23 +++++++++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 783af12..ba7ee91 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,11 +20,13 @@ DISTCHECK_CONFIGURE_FLAGS = \
 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 \
@@ -51,6 +53,16 @@ MAINTAINERCLEANFILES = \
 	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; \
@@ -79,4 +91,7 @@ ChangeLog:
 
 .PHONY: ChangeLog
 
+# Code coverage support
+include lcov.mk
+
 -include $(top_srcdir)/git.mk
diff --git a/lcov.mk b/lcov.mk
new file mode 100644
index 0000000..2ea2531
--- /dev/null
+++ b/lcov.mk
@@ -0,0 +1,23 @@
+# 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:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]