summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorAndrew Sidwell <andy@entai.co.uk>2008-06-08 22:02:06 +0000
committerAndrew Sidwell <andy@entai.co.uk>2008-06-08 22:02:06 +0000
commit1350c363e81dba44797474a4b7e04c897f52b99d (patch)
treef7507ac56d947c9f9719ec48ddb482f72c174ab6 /build
parentd0513b69248953feae89dfa63a286aededeb22a1 (diff)
downloadlibhubbub-1350c363e81dba44797474a4b7e04c897f52b99d.tar.gz
libhubbub-1350c363e81dba44797474a4b7e04c897f52b99d.tar.bz2
Add a "coverage" target (like libcss) which runs lcov for nice-looking coverage statistics.
svn path=/trunk/hubbub/; revision=4312
Diffstat (limited to 'build')
-rw-r--r--build/Makefile.common19
1 files changed, 19 insertions, 0 deletions
diff --git a/build/Makefile.common b/build/Makefile.common
index bc79ff5..79b81d1 100644
--- a/build/Makefile.common
+++ b/build/Makefile.common
@@ -11,6 +11,7 @@ EXPORT := $(CURDIR)/dist
TOP := $(CURDIR)
RELEASEDIR := build/Release
DEBUGDIR := build/Debug
+COVERAGEDIR := build/coverage
# List of items to delete on clean
ITEMS_CLEAN :=
@@ -48,8 +49,25 @@ debug: setup $(addprefix $(DEBUGDIR)/,$(OBJECTS))
test: debug $(TARGET_TESTS)
+coverage: clean
+ @$(LCOV) --directory . --zerocounters
+ @$(MAKE) test CFLAGS="$(CFLAGS) -fprofile-arcs -ftest-coverage" \
+ LDFLAGS="$(LDFLAGS) -lgcov"
+ @$(LCOV) --directory $(DEBUGDIR) --base-directory $(TOP) \
+ --capture --output-file $(COVERAGEDIR)/$(COMPONENT)_tmp.info
+ @$(LCOV) --extract $(COVERAGEDIR)/$(COMPONENT)_tmp.info "$(TOP)/src*" \
+ -o $(COVERAGEDIR)/$(COMPONENT).info
+ @$(RM) $(RMFLAGS) $(COVERAGEDIR)/$(COMPONENT)_tmp.info
+ @$(GENHTML) -o $(COVERAGEDIR) --num-spaces 2 \
+ $(COVERAGEDIR)/$(COMPONENT).info
+
+profile: clean
+ @$(MAKE) test CFLAGS="$(CFLAGS) -pg" LDFLAGS="-pg $(LDFLAGS)"
+
clean:
-@$(RM) $(RMFLAGS) $(ITEMS_CLEAN)
+ -@$(RM) $(RMFLAGS) gmon.out
+ -@$(RM) $(RMFLAGS) -r $(COVERAGEDIR)
-@$(RM) $(RMFLAGS) -r $(RELEASEDIR)
-@$(RM) $(RMFLAGS) -r $(DEBUGDIR)
-@$(RM) $(RMFLAGS) $(COMPONENT).a
@@ -63,6 +81,7 @@ distclean: clean
setup:
@$(MKDIR) $(MKDIRFLAGS) $(RELEASEDIR)
@$(MKDIR) $(MKDIRFLAGS) $(DEBUGDIR)
+ @$(MKDIR) $(MKDIRFLAGS) $(COVERAGEDIR)
export: release
@$(MKDIR) $(MKDIRFLAGS) $(TOP)/dist/lib