Makefile.am 4.58 KB
Newer Older
1
ACLOCAL_AMFLAGS = -I m4macros ${ACLOCAL_FLAGS}
2 3 4
# ^^^^^^^^ This has to be the first line and cannot come later in this
# Makefile.am due to some bork in some versions of autotools.

Francis Dupont's avatar
Francis Dupont committed
5
SUBDIRS = compatcheck tools doc . ext src m4macros @PREMIUM_DIR@ @CONTRIB_DIR@
6

7 8 9
USE_LCOV=@USE_LCOV@
LCOV=@LCOV@
GENHTML=@GENHTML@
10
DISTCHECK_GTEST_CONFIGURE_FLAG=@DISTCHECK_GTEST_CONFIGURE_FLAG@
11
DISTCHECK_CRYPTO_CONFIGURE_FLAG=@DISTCHECK_CRYPTO_CONFIGURE_FLAG@
12
DISTCHECK_BOOST_CONFIGURE_FLAG=@DISTCHECK_BOOST_CONFIGURE_FLAG@
13
OVERALL_COVERAGE_DIR=$(abs_top_builddir)/coverage-cpp-html
14 15
DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG=@DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG@
DISTCHECK_KEA_SHELL_CONFIGURE_FLAG=@DISTCHECK_KEA_SHELL_CONFIGURE_FLAG@
16

17 18
DISTCLEANFILES = config.report

19
# When running distcheck target, do not install the configurations
20
DISTCHECK_CONFIGURE_FLAGS = --disable-install-configurations
21

22 23 24
# Use same --with-gtest flag if set
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_GTEST_CONFIGURE_FLAG)

25 26 27
# Keep the crypto backend config
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_CRYPTO_CONFIGURE_FLAG)

28 29 30
# Keep the Boost configuration which becomes sensible
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_BOOST_CONFIGURE_FLAG)

31 32 33 34 35 36
# Keep the log4cplus path too
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG)

# Keep kea-shell if enabled
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_KEA_SHELL_CONFIGURE_FLAG)

37 38
dist_doc_DATA = AUTHORS COPYING ChangeLog README

39 40 41 42 43 44 45 46 47 48 49 50
.PHONY: check-valgrind check-valgrind-suppress

check-valgrind:
if HAVE_VALGRIND
	@VALGRIND_COMMAND="$(VALGRIND) -q --gen-suppressions=all --track-origins=yes --num-callers=48 --leak-check=full --fullpath-after=" \
	make -C $(abs_top_builddir) check
else
	@echo "*** Valgrind is required for check-valgrind ***"; exit 1;
endif

check-valgrind-suppress:
if HAVE_VALGRIND
51
	@VALGRIND_COMMAND="$(VALGRIND) -q --gen-suppressions=all --track-origins=yes --error-exitcode=1 --suppressions=$(abs_top_srcdir)/src/valgrind-suppressions --suppressions=$(abs_top_srcdir)/src/valgrind-suppressions.revisit --num-callers=48 --leak-check=full --fullpath-after=" \
52 53 54 55 56
	make -C $(abs_top_builddir) check
else
	@echo "*** Valgrind is required for check-valgrind-suppress ***"; exit 1;
endif

57
clean-cpp-coverage:
58 59
	@if [ $(USE_LCOV) = yes ] ; then \
		$(LCOV) --directory . --zerocounters; \
60
		rm -rf $(OVERALL_COVERAGE_DIR); \
61
	else \
62 63
		echo "C++ code coverage not enabled at configuration time." ; \
		echo "Use: ./configure --with-lcov" ; \
64 65
	fi

66
perform-coverage:
67
	find src -mindepth 2 -maxdepth 2 -type d | xargs -I{} bash -c "cd {}; make check || true"
68

69
report-cpp-coverage:
Andrei Pavel's avatar
Andrei Pavel committed
70 71 72 73 74 75 76 77 78 79
if HAVE_BOTAN
BOTAN_PATH=botan/\*
else
BOTAN_PATH=
endif
if HAVE_OPENSSL
OPENSSL_PATH=openssl/\*
else
OPENSSL_PATH=
endif
80
	@if [ $(USE_LCOV) = yes ] ; then \
81 82 83
		$(LCOV) --capture --directory . \
			--ignore-errors gcov,source,graph \
			--output-file all.info; \
84
		$(LCOV) --remove all.info \
85
			c++/* \
86
			boost/\* \
87
if HAVE_BOTAN
88
			botan/\* \
89
endif
90
			gtest/\* \
91
			include/\* \
92
			lib/\eval/\* \
93
			log4cplus/\* \
94
			unittests/\* \
95 96 97
			tests/\* \
			testutils/\* \
			valgrind/\* \
Andrei Pavel's avatar
Andrei Pavel committed
98 99
			$(BOTAN_PATH) \
			$(OPENSSL_PATH) \
100 101 102
			--ignore-errors gcov,source,graph \
			--output report.info; \
		sed --in-place --expression "s|$(abs_top_srcdir)|$(abs_top_builddir)|g" report.info; \
103 104 105
		"$(GENHTML)" --frames --show-details --title 'Kea code coverage report' --legend \
                --function-coverage --ignore-errors source --demangle-cpp \
                --output "$(OVERALL_COVERAGE_DIR)" report.info; \
106
		printf "Generated C++ code coverage report in HTML at %s.\n" "$(OVERALL_COVERAGE_DIR)"; \
107 108 109 110
	else \
		echo "C++ code coverage not enabled at configuration time." ; \
		echo "Use: ./configure --with-lcov" ; \
	fi
111

112
# for c++ test coverage
Andrei Pavel's avatar
Andrei Pavel committed
113 114
.NOTPARALLEL: coverage

115
coverage: clean-coverage perform-coverage report-coverage
116

117
clean-coverage: clean-cpp-coverage
118

119
report-coverage: report-cpp-coverage
120

121 122
# for static C++ check using cppcheck (when available)
cppcheck:
Andrei Pavel's avatar
Andrei Pavel committed
123 124
	cppcheck -I./src/lib -I./src/bin --enable=all \
		--suppressions-list=src/cppcheck-suppress.lst --inline-suppr \
125 126 127 128
		--quiet --error-exitcode=1 \
		--template '{file}:{line}: check_fail: {message} ({severity},{id})' \
		src

Tomek Mrugalski's avatar
Tomek Mrugalski committed
129 130 131
# These steps are necessary during installation
install-exec-hook:
	mkdir -p $(DESTDIR)${localstatedir}/log/
132
	mkdir -p $(DESTDIR)${localstatedir}/run/${PACKAGE_NAME}
Tomek Mrugalski's avatar
Tomek Mrugalski committed
133

Francis Dupont's avatar
Francis Dupont committed
134
EXTRA_DIST  = tools/path_replacer.sh
135
EXTRA_DIST += tools/mk_cfgrpt.sh
136

137 138
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = dns++.pc
139

140
CLEANFILES = $(abs_top_builddir)/logger_lockfile
141

142 143 144
# config.h may be included by headers supplied for building user-written
# hooks libraries, so we need to include it in the distribution.
pkginclude_HEADERS = config.h