coverage: Make genhtml not fail if sources are not found
[strongswan.git] / Makefile.am
1 SUBDIRS = src man conf init testing
2
3 if USE_SCRIPTS
4   SUBDIRS += scripts
5 endif
6
7 if USE_SILENT_RULES
8   AM_MAKEFLAGS = -s
9 endif
10
11 ACLOCAL_AMFLAGS = -I m4/config
12
13 EXTRA_DIST = Doxyfile.in LICENSE Android.common.mk.in Android.common.mk Android.mk
14 CLEANFILES = Doxyfile
15 BUILT_SOURCES = Android.common.mk
16 MAINTAINERCLEANFILES = Android.common.mk
17
18 if USE_DEV_HEADERS
19 config_includedir = $(ipseclibdir)/include
20 nodist_config_include_HEADERS = config.h
21 endif
22
23 # we leave config files behind intentionally so prevent distcheck from complaining
24 distuninstallcheck_listfiles = find . -type f \! -name '*.conf' -print
25
26 Android.common.mk :     Android.common.mk.in configure.ac
27                 $(AM_V_GEN) \
28                 sed \
29                 -e "s:\@PACKAGE_VERSION\@:$(PACKAGE_VERSION):" \
30                 $(srcdir)/$@.in > $@
31
32 Doxyfile :      Doxyfile.in
33                 $(AM_V_GEN) \
34                 sed \
35                 -e "s:\@PACKAGE_VERSION\@:$(PACKAGE_VERSION):" \
36                 -e "s:\@PACKAGE_NAME\@:$(PACKAGE_NAME):" \
37                 -e "s:\@SRC_DIR\@:$(srcdir):" \
38                 $(srcdir)/$@.in > $@
39
40 apidoc :        Doxyfile
41                 doxygen
42
43 cov-reset-common:
44                 @rm -rf $(top_builddir)/coverage
45                 @find $(top_builddir)/src $(top_builddir)/scripts -name "*.gcda" -delete
46
47 if COVERAGE
48 cov-reset: cov-reset-common
49                 @lcov --zerocounters --directory $(top_builddir)
50
51 cov-report:
52                 @mkdir $(top_builddir)/coverage
53                 lcov -c -o $(top_builddir)/coverage/coverage.info -d $(top_builddir) \
54                          --rc lcov_branch_coverage=1
55                 lcov -r $(top_builddir)/coverage/coverage.info '*/tests/*' \
56                          -o $(top_builddir)/coverage/coverage.cleaned.info \
57                          --rc lcov_branch_coverage=1
58                 genhtml --num-spaces 4 --legend --branch-coverage --ignore-errors source \
59                                 -t "$(PACKAGE_STRING)" \
60                                 -o $(top_builddir)/coverage/html \
61                                 -p `readlink -m $(abs_top_srcdir)`/src \
62                                 $(top_builddir)/coverage/coverage.cleaned.info
63                 @echo "Coverage Report at $(top_builddir)/coverage/html" >&2
64
65 coverage:
66                 @$(MAKE) cov-reset
67                 @$(MAKE) check
68                 @$(MAKE) cov-report
69 else
70 coverage:
71                 @echo "reconfigure with --enable-coverage"
72 endif
73
74 clean-local: cov-reset-common
75                 @find $(top_builddir)/src $(top_builddir)/scripts -name "*.gcno" -delete
76                 @rm -rf apidoc
77
78 .PHONY: cov-reset-common cov-reset cov-report coverage