Makefile.am 2.6 KB
Newer Older
1
ACLOCAL_AMFLAGS = -I m4
2
SUBDIRS = libtap src tests tests-fuzz samples doc
3

4 5 6
singlehtml install-singlehtml:
	$(MAKE) -C doc $@

7
AM_DISTCHECK_CONFIGURE_FLAGS = \
8 9
	--disable-code-coverage \
	--without-bash-completions
10

11 12
CODE_COVERAGE_INFO = coverage.info
CODE_COVERAGE_HTML = coverage.html
13 14 15 16
CODE_COVERAGE_DIRS =	\
	src/knot	\
	src/libknot	\
	src/zscanner	\
Ondřej Surý's avatar
Ondřej Surý committed
17 18
	src/dnssec/lib	\
	src/dnssec/shared
19

20
code_coverage_quiet = --quiet
21 22 23

check-code-coverage:
if CODE_COVERAGE_ENABLED
24
	$(MAKE) $(AM_MAKEFLAGS) code-coverage-initial
25 26 27
	-$(MAKE) $(AM_MAKEFLAGS) -k check
	$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
	$(MAKE) $(AM_MAKEFLAGS) code-coverage-html
28 29 30 31 32 33 34 35
	$(MAKE) $(AM_MAKEFLAGS) code-coverage-summary
else
	@echo "You need to run configure with --enable-code-coverage to enable code coverage"
endif

code-coverage-initial:
if CODE_COVERAGE_ENABLED
	$(LCOV) $(code_coverage_quiet) \
36 37
		--no-external \
		$(foreach dir, $(CODE_COVERAGE_DIRS), --directory $(top_builddir)/$(dir)) \
38 39
		--capture --initial \
		--ignore-errors source \
40 41 42
		--no-checksum \
		--compat-libtool \
		--output-file $(CODE_COVERAGE_INFO)
43 44 45 46 47 48 49
else
	@echo "You need to run configure with --enable-code-coverage to enable code coverage"
endif

code-coverage-capture:
if CODE_COVERAGE_ENABLED
	$(LCOV) $(code_coverage_quiet) \
50 51
		--no-external \
		$(foreach dir, $(CODE_COVERAGE_DIRS), --directory $(builddir)/$(dir)) \
52 53
		--capture \
		--ignore-errors source \
54 55 56
		--no-checksum \
		--compat-libtool \
		--output-file $(CODE_COVERAGE_INFO)
57 58 59 60 61 62 63
else
	@echo "You need to run configure with --enable-code-coverage to enable code coverage"
endif

code-coverage-html:
if CODE_COVERAGE_ENABLED
	@echo "Generating code coverage HTML report (this might take a while)"
64 65 66 67 68 69
	LANG=C $(GENHTML) $(code_coverage_quiet) \
		--output-directory $(CODE_COVERAGE_HTML) \
		--title "Knot DNS $(PACKAGE_VERSION) Code Coverage" \
		--legend --show-details \
		--ignore-errors source \
		$(CODE_COVERAGE_INFO)
70 71 72 73
else
	@echo "You need to run configure with --enable-code-coverage to enable code coverage"
endif

74 75 76
code-coverage-summary:
if CODE_COVERAGE_ENABLED
	$(LCOV) \
77
		--summary $(CODE_COVERAGE_INFO)
78 79 80 81
else
	@echo "You need to run configure with --enable-code-coverage to enable code coverage"
endif

82 83
if CODE_COVERAGE_ENABLED
clean-local: code-coverage-clean
84
	-find . -name "*.gcno" -delete
85 86
code-coverage-clean:
	-$(LCOV) --directory $(top_builddir) -z
87
	-rm -rf $(CODE_COVERAGE_INFO) $(CODE_COVERAGE_HTML)
88 89 90
	-find . -name "*.gcda" -o -name "*.gcov" -delete
endif

91
.PHONY: check-code-coverage code-coverage-initial code-coverage-capture code-coverage-html code-coverage-summary code-coverage-clean singlehtml install-singlehtml
92
.NOTPARALLEL: clean