Makefile.am 2.55 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

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

19
code_coverage_quiet = --quiet
20 21 22

check-code-coverage:
if CODE_COVERAGE_ENABLED
23
	$(MAKE) $(AM_MAKEFLAGS) code-coverage-initial
24 25 26
	-$(MAKE) $(AM_MAKEFLAGS) -k check
	$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
	$(MAKE) $(AM_MAKEFLAGS) code-coverage-html
27 28 29 30 31 32 33 34
	$(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) \
35 36
		--no-external \
		$(foreach dir, $(CODE_COVERAGE_DIRS), --directory $(top_builddir)/$(dir)) \
37 38
		--capture --initial \
		--ignore-errors source \
39 40 41
		--no-checksum \
		--compat-libtool \
		--output-file $(CODE_COVERAGE_INFO)
42 43 44 45 46 47 48
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) \
49 50
		--no-external \
		$(foreach dir, $(CODE_COVERAGE_DIRS), --directory $(builddir)/$(dir)) \
51 52
		--capture \
		--ignore-errors source \
53 54 55
		--no-checksum \
		--compat-libtool \
		--output-file $(CODE_COVERAGE_INFO)
56 57 58 59 60 61 62
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)"
63 64 65 66 67 68
	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)
69 70 71 72
else
	@echo "You need to run configure with --enable-code-coverage to enable code coverage"
endif

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

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

90
.PHONY: check-code-coverage code-coverage-initial code-coverage-capture code-coverage-html code-coverage-summary code-coverage-clean singlehtml install-singlehtml