From 1350c363e81dba44797474a4b7e04c897f52b99d Mon Sep 17 00:00:00 2001 From: Andrew Sidwell Date: Sun, 8 Jun 2008 22:02:06 +0000 Subject: Add a "coverage" target (like libcss) which runs lcov for nice-looking coverage statistics. svn path=/trunk/hubbub/; revision=4312 --- build/Makefile.common | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'build/Makefile.common') 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 -- cgit v1.2.3