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

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

8 9 10 11 12 13 14
.PHONY: check-compile
check-compile:
	$(MAKE) $(AM_MAKEFLAGS) -C libtap $@
	$(MAKE) $(AM_MAKEFLAGS) -C src $@
	$(MAKE) $(AM_MAKEFLAGS) -C tests $@
	$(MAKE) $(AM_MAKEFLAGS) -C tests-fuzz $@

15
AM_DISTCHECK_CONFIGURE_FLAGS =
16

17 18
CODE_COVERAGE_INFO = coverage.info
CODE_COVERAGE_HTML = coverage.html
19 20 21 22 23 24 25
CODE_COVERAGE_DIRS =		\
	src/contrib		\
	src/dnssec/lib		\
	src/dnssec/shared	\
	src/knot		\
	src/libknot		\
	src/zscanner
26

27
code_coverage_quiet = --quiet
28 29 30

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

81 82 83
code-coverage-summary:
if CODE_COVERAGE_ENABLED
	$(LCOV) \
84
		--summary $(CODE_COVERAGE_INFO)
85 86 87 88
else
	@echo "You need to run configure with --enable-code-coverage to enable code coverage"
endif

89 90
if CODE_COVERAGE_ENABLED
clean-local: code-coverage-clean
91
	-find . -name "*.gcno" -delete
92 93
code-coverage-clean:
	-$(LCOV) --directory $(top_builddir) -z
94
	-rm -rf $(CODE_COVERAGE_INFO) $(CODE_COVERAGE_HTML)
95 96 97
	-find . -name "*.gcda" -o -name "*.gcov" -delete
endif

98 99

.PHONY: check-code-coverage code-coverage-initial code-coverage-capture code-coverage-html code-coverage-summary code-coverage-clean
100
.NOTPARALLEL: clean