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

5 6 7
# We now build doc after src/, because docgen, a tool to generate API
# documentation requires libkea-exceptions and libkea-cc.
SUBDIRS = compatcheck tools . ext src doc m4macros @PREMIUM_DIR@ @CONTRIB_DIR@
8

9 10 11
USE_LCOV=@USE_LCOV@
LCOV=@LCOV@
GENHTML=@GENHTML@
12
DISTCHECK_GTEST_CONFIGURE_FLAG=@DISTCHECK_GTEST_CONFIGURE_FLAG@
13
DISTCHECK_CRYPTO_CONFIGURE_FLAG=@DISTCHECK_CRYPTO_CONFIGURE_FLAG@
14
DISTCHECK_BOOST_CONFIGURE_FLAG=@DISTCHECK_BOOST_CONFIGURE_FLAG@
15
DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG=@DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG@
16
DISTCHECK_PERFDHCP_CONFIGURE_FLAG=@DISTCHECK_PERFDHCP_CONFIGURE_FLAG@
17
DISTCHECK_KEA_SHELL_CONFIGURE_FLAG=@DISTCHECK_KEA_SHELL_CONFIGURE_FLAG@
18 19
DISTCHECK_PREMIUM_CONFIGURE_FLAG=@DISTCHECK_PREMIUM_CONFIGURE_FLAG@
DISTCHECK_CONTRIB_CONFIGURE_FLAG=@DISTCHECK_CONTRIB_CONFIGURE_FLAG@
20
DISTCHECK_SYSREPO_CONFIGURE_FLAG=@DISTCHECK_SYSREPO_CONFIGURE_FLAG@
21 22

OVERALL_COVERAGE_DIR=$(abs_top_builddir)/coverage-cpp-html
23

24 25
DISTCLEANFILES = config.report

26
# When running distcheck target, do not install the configurations
27
DISTCHECK_CONFIGURE_FLAGS = --disable-install-configurations
28

29 30 31
# Use same --with-gtest flag if set
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_GTEST_CONFIGURE_FLAG)

32 33 34
# Keep the crypto backend config
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_CRYPTO_CONFIGURE_FLAG)

35 36 37
# Keep the Boost configuration which becomes sensible
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_BOOST_CONFIGURE_FLAG)

38 39 40
# Keep the log4cplus path too
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG)

41 42 43
# Keep perfdhcp if enabled
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_PERFDHCP_CONFIGURE_FLAG)

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

47 48 49 50 51 52
# Keep the premium config
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_PREMIUM_CONFIGURE_FLAG)

# Keep the contrib config
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_CONTRIB_CONFIGURE_FLAG)

53 54 55
# keerp the sysrepo config
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_SYSREPO_CONFIGURE_FLAG)

56
dist_doc_DATA = AUTHORS COPYING ChangeLog README contributors-guide.md
57

58 59 60 61 62 63 64 65 66 67 68 69
.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
70
	@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=" \
71 72 73 74 75
	make -C $(abs_top_builddir) check
else
	@echo "*** Valgrind is required for check-valgrind-suppress ***"; exit 1;
endif

76
clean-cpp-coverage:
77 78
	@if [ $(USE_LCOV) = yes ] ; then \
		$(LCOV) --directory . --zerocounters; \
79
		rm -rf $(OVERALL_COVERAGE_DIR); \
80
	else \
81 82
		echo "C++ code coverage not enabled at configuration time." ; \
		echo "Use: ./configure --with-lcov" ; \
83 84
	fi

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

88
report-cpp-coverage:
89 90 91 92 93 94 95 96 97 98
if HAVE_BOTAN
BOTAN_PATH=botan/\*
else
BOTAN_PATH=
endif
if HAVE_OPENSSL
OPENSSL_PATH=openssl/\*
else
OPENSSL_PATH=
endif
99
	@if [ $(USE_LCOV) = yes ] ; then \
100 101 102
		$(LCOV) --capture --directory . \
			--ignore-errors gcov,source,graph \
			--output-file all.info; \
103
		$(LCOV) --remove all.info \
104
			c++/* \
105
			boost/\* \
106
if HAVE_BOTAN
107
			botan/\* \
108
endif
109
			ext/coroutine/\* \
110
			gtest/\* \
111
			include/\* \
112
			lib/\eval/\* \
113
			log4cplus/\* \
114
			unittests/\* \
115 116 117
			tests/\* \
			testutils/\* \
			valgrind/\* \
118 119
			$(BOTAN_PATH) \
			$(OPENSSL_PATH) \
120 121 122
			--ignore-errors gcov,source,graph \
			--output report.info; \
		sed --in-place --expression "s|$(abs_top_srcdir)|$(abs_top_builddir)|g" report.info; \
123 124 125
		"$(GENHTML)" --frames --show-details --title 'Kea code coverage report' --legend \
                --function-coverage --ignore-errors source --demangle-cpp \
                --output "$(OVERALL_COVERAGE_DIR)" report.info; \
126
		printf "Generated C++ code coverage report in HTML at %s.\n" "$(OVERALL_COVERAGE_DIR)"; \
127 128 129 130
	else \
		echo "C++ code coverage not enabled at configuration time." ; \
		echo "Use: ./configure --with-lcov" ; \
	fi
131

132
# for c++ test coverage
133 134
.NOTPARALLEL: coverage

135
coverage: clean-coverage perform-coverage report-coverage
136

137
clean-coverage: clean-cpp-coverage
138

139
report-coverage: report-cpp-coverage
140

141 142
# for static C++ check using cppcheck (when available)
cppcheck:
143 144
	cppcheck -I./src/lib -I./src/bin --enable=all \
		--suppressions-list=src/cppcheck-suppress.lst --inline-suppr \
145 146 147 148
		--quiet --error-exitcode=1 \
		--template '{file}:{line}: check_fail: {message} ({severity},{id})' \
		src

149 150 151
# These steps are necessary during installation
install-exec-hook:
	mkdir -p $(DESTDIR)${localstatedir}/log/
152
	mkdir -p $(DESTDIR)${localstatedir}/run/${PACKAGE_NAME}
153

Francis Dupont's avatar
Francis Dupont committed
154
EXTRA_DIST  = tools/path_replacer.sh
155
EXTRA_DIST += tools/mk_cfgrpt.sh
156

157 158 159
#### include external sources in the distributed tarball:
EXTRA_DIST += ext/coroutine/coroutine.hpp

160
CLEANFILES = $(abs_top_builddir)/logger_lockfile
161

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