forked from biancini/boost.test-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (35 loc) · 1.57 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
TARGETS=main hello suites fixtures assertions
CXX=g++
CPPFLAGS=-Wall
SRCDIR=src
TESTDIR=test
BINDIR=bin
REPORTDIR=reports
WEBDIR=/var/www/html/coverage
all: $(addprefix $(BINDIR)/,$(TARGETS))
$(BINDIR)/%: $(SRCDIR)/add.cpp $(SRCDIR)/add.h $(TESTDIR)/%.cpp
$(CXX) -I$(SRCDIR) -o $(notdir $@) $(SRCDIR)/add.h $(SRCDIR)/add.cpp $(TESTDIR)/$(notdir $@).cpp -lboost_unit_test_framework -fprofile-arcs -ftest-coverage --coverage --debug
-mv $(notdir $@) $(BINDIR)/
-mv *.gcno $(REPORTDIR)/
test: $(addprefix $(BINDIR)/,$(TARGETS)) $(addprefix run-,$(TARGETS)) $(addprefix val-,$(TARGETS))
run-%: $(addprefix $(BINDIR)/,%)
-$^ --log_format=XML --log_sink=$(REPORTDIR)/$(notdir $^)report.xml --log_level=test_suite -report_level=no
-mv *.gcda $(REPORTDIR) 2>/dev/null
val-%: $(addprefix $(BINDIR)/,%)
-valgrind --xml=yes --xml-file=$(REPORTDIR)/$(notdir $^)-valgrind-report.xml $(BINDIR)/$(notdir $^)
-mv *.gcda $(REPORTDIR) 2>/dev/null
coverage: test $(addprefix cov-,$(TARGETS))
lcov --capture --directory . --output-file $(REPORTDIR)/test-coverage.info --rc lcov_branch_coverage=1 --no-external
gcovr -x -r $(REPORTDIR) > $(REPORTDIR)/test-coverage.xml
cov-%: $(addprefix $(BINDIR)/,%)
gcov --object-directory $(REPORTDIR) -r $(TESTDIR)/$(notdir $^).cpp
-mv *.gcov $(REPORTDIR) 2>/dev/null
coverage-web: coverage
genhtml $(REPORTDIR)/test-coverage.info --rc lcov_branch_coverage=1 --output-directory $(WEBDIR)
style:
vera++ -c $(REPORTDIR)/code-style.xml src/*.cpp
quality: coverage style
sonar: quality
sonar-runner
clean:
rm -f $(addprefix $(BINDIR)/,$(TARGETS)) $(REPORTDIR)/*