summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-25 05:28:37 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-10-25 05:28:37 +0000
commit503abf607a9e1d5d778edb48e00514f5cb73f777 (patch)
tree8a8e7988e567bcdc6f5c5177dd95311e30649e4f
parent4363e8a651c2ca24d7fc41e5707bc44ed102e94a (diff)
Add 'coverage' configuration to Makefile.
git-svn-id: https://pugixml.googlecode.com/svn/trunk@1079 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r--Makefile14
1 files changed, 14 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index eddd4f2..d351e0f 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,12 @@ ifeq ($(config),release)
CXXFLAGS+=-O3 -DNDEBUG
endif
+ifeq ($(config),coverage)
+ CXXFLAGS+=-DNDEBUG
+ CXXFLAGS+=-fprofile-arcs -ftest-coverage
+ LDFLAGS+=-fprofile-arcs
+endif
+
ifneq ($(defines),standard)
COMMA=,
CXXFLAGS+=-D $(subst $(COMMA), -D ,$(defines))
@@ -22,8 +28,16 @@ OBJECTS=$(SOURCES:%=$(BUILD)/%.o)
all: $(EXECUTABLE)
+ifeq ($(config),coverage)
test: $(EXECUTABLE)
+ @find $(BUILD) -name '*.gcda' | xargs rm
./$(EXECUTABLE)
+ @gcov -b -c $(BUILD)/src/pugixml.cpp.gcda | sed -e '/./{H;$!d;}' -e 'x;/pugixml.cpp/!d;'
+ @ls *.gcov | grep -v pugixml.cpp.gcov | xargs rm
+else
+test: $(EXECUTABLE)
+ ./$(EXECUTABLE)
+endif
clean:
rm -rf $(BUILD)