Makefile.am 2.73 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
CODE_COVERAGE_DIRS =	\
	src/knot	\
	src/libknot	\
	src/zscanner	\
Ondřej Surý's avatar
Ondřej Surý committed
23 24
	src/dnssec/lib	\
	src/dnssec/shared
25

26
code_coverage_quiet = --quiet
27 28 29

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

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

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

97 98

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