Makefile.am 5.07 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 14
DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG=@DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG@
DISTCHECK_KEA_SHELL_CONFIGURE_FLAG=@DISTCHECK_KEA_SHELL_CONFIGURE_FLAG@
15 16
DISTCHECK_PREMIUM_CONFIGURE_FLAG=@DISTCHECK_PREMIUM_CONFIGURE_FLAG@
DISTCHECK_CONTRIB_CONFIGURE_FLAG=@DISTCHECK_CONTRIB_CONFIGURE_FLAG@
17
DISTCHECK_SYSREPO_CONFIGURE_FLAG=@DISTCHECK_SYSREPO_CONFIGURE_FLAG@
18 19

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

21 22
DISTCLEANFILES = config.report

23
# When running distcheck target, do not install the configurations
24
DISTCHECK_CONFIGURE_FLAGS = --disable-install-configurations
25

26 27 28
# Use same --with-gtest flag if set
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_GTEST_CONFIGURE_FLAG)

29 30 31
# Keep the crypto backend config
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_CRYPTO_CONFIGURE_FLAG)

32 33 34
# Keep the Boost configuration which becomes sensible
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_BOOST_CONFIGURE_FLAG)

35 36 37 38 39 40
# 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)

41 42 43 44 45 46
# Keep the premium config
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_PREMIUM_CONFIGURE_FLAG)

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

47 48 49
# keerp the sysrepo config
DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_SYSREPO_CONFIGURE_FLAG)

50 51
dist_doc_DATA = AUTHORS COPYING ChangeLog README

52 53 54 55 56 57 58 59 60 61 62 63
.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
64
	@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=" \
65 66 67 68 69
	make -C $(abs_top_builddir) check
else
	@echo "*** Valgrind is required for check-valgrind-suppress ***"; exit 1;
endif

70
clean-cpp-coverage:
71 72
	@if [ $(USE_LCOV) = yes ] ; then \
		$(LCOV) --directory . --zerocounters; \
73
		rm -rf $(OVERALL_COVERAGE_DIR); \
74
	else \
75 76
		echo "C++ code coverage not enabled at configuration time." ; \
		echo "Use: ./configure --with-lcov" ; \
77 78
	fi

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

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

125
# for c++ test coverage
Andrei Pavel's avatar
Andrei Pavel committed
126 127
.NOTPARALLEL: coverage

128
coverage: clean-coverage perform-coverage report-coverage
129

130
clean-coverage: clean-cpp-coverage
131

132
report-coverage: report-cpp-coverage
133

134 135
# for static C++ check using cppcheck (when available)
cppcheck:
Andrei Pavel's avatar
Andrei Pavel committed
136 137
	cppcheck -I./src/lib -I./src/bin --enable=all \
		--suppressions-list=src/cppcheck-suppress.lst --inline-suppr \
138 139 140 141
		--quiet --error-exitcode=1 \
		--template '{file}:{line}: check_fail: {message} ({severity},{id})' \
		src

Tomek Mrugalski's avatar
Tomek Mrugalski committed
142 143 144
# These steps are necessary during installation
install-exec-hook:
	mkdir -p $(DESTDIR)${localstatedir}/log/
145
	mkdir -p $(DESTDIR)${localstatedir}/run/${PACKAGE_NAME}
Tomek Mrugalski's avatar
Tomek Mrugalski committed
146

Francis Dupont's avatar
Francis Dupont committed
147
EXTRA_DIST  = tools/path_replacer.sh
148
EXTRA_DIST += tools/mk_cfgrpt.sh
149

150 151
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = dns++.pc
152

153
CLEANFILES = $(abs_top_builddir)/logger_lockfile
154

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