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

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

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

13
AM_DISTCHECK_CONFIGURE_FLAGS =
14

15 16
CODE_COVERAGE_INFO = coverage.info
CODE_COVERAGE_HTML = coverage.html
17 18 19
CODE_COVERAGE_DIRS =		\
	src/contrib		\
	src/knot		\
20
	src/libdnssec		\
21
	src/libknot		\
22
	src/libzscanner
23

24
code_coverage_quiet = --quiet
25 26 27

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

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

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

95 96

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