xref: /freebsd-src/sys/contrib/openzfs/config/ax_code_coverage.m4 (revision e92ffd9b626833ebdbf2742c8ffddc6cd94b963e)
1eda14cbcSMatt Macy# ===========================================================================
2eda14cbcSMatt Macy#     https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
3eda14cbcSMatt Macy# ===========================================================================
4eda14cbcSMatt Macy#
5eda14cbcSMatt Macy# SYNOPSIS
6eda14cbcSMatt Macy#
7eda14cbcSMatt Macy#   AX_CODE_COVERAGE()
8eda14cbcSMatt Macy#
9eda14cbcSMatt Macy# DESCRIPTION
10eda14cbcSMatt Macy#
11eda14cbcSMatt Macy#   Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS,
12eda14cbcSMatt Macy#   CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included
13eda14cbcSMatt Macy#   in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every
14eda14cbcSMatt Macy#   build target (program or library) which should be built with code
15eda14cbcSMatt Macy#   coverage support. Also defines CODE_COVERAGE_RULES which should be
16eda14cbcSMatt Macy#   substituted in your Makefile; and $enable_code_coverage which can be
17eda14cbcSMatt Macy#   used in subsequent configure output. CODE_COVERAGE_ENABLED is defined
18eda14cbcSMatt Macy#   and substituted, and corresponds to the value of the
19eda14cbcSMatt Macy#   --enable-code-coverage option, which defaults to being disabled.
20eda14cbcSMatt Macy#
21eda14cbcSMatt Macy#   Test also for gcov program and create GCOV variable that could be
22eda14cbcSMatt Macy#   substituted.
23eda14cbcSMatt Macy#
24eda14cbcSMatt Macy#   Note that all optimization flags in CFLAGS must be disabled when code
25eda14cbcSMatt Macy#   coverage is enabled.
26eda14cbcSMatt Macy#
27eda14cbcSMatt Macy#   Usage example:
28eda14cbcSMatt Macy#
29eda14cbcSMatt Macy#   configure.ac:
30eda14cbcSMatt Macy#
31eda14cbcSMatt Macy#     AX_CODE_COVERAGE
32eda14cbcSMatt Macy#
33eda14cbcSMatt Macy#   Makefile.am:
34eda14cbcSMatt Macy#
35eda14cbcSMatt Macy#     @CODE_COVERAGE_RULES@
36eda14cbcSMatt Macy#     my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ...
37eda14cbcSMatt Macy#     my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ...
38eda14cbcSMatt Macy#     my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ...
39eda14cbcSMatt Macy#     my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ...
40eda14cbcSMatt Macy#
41eda14cbcSMatt Macy#   This results in a "check-code-coverage" rule being added to any
42eda14cbcSMatt Macy#   Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module
43eda14cbcSMatt Macy#   has been configured with --enable-code-coverage). Running `make
44eda14cbcSMatt Macy#   check-code-coverage` in that directory will run the module's test suite
45eda14cbcSMatt Macy#   (`make check`) and build a code coverage report detailing the code which
46eda14cbcSMatt Macy#   was touched, then print the URI for the report.
47eda14cbcSMatt Macy#
48eda14cbcSMatt Macy#   In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined
49eda14cbcSMatt Macy#   instead of CODE_COVERAGE_LIBS. They are both still defined, but use of
50eda14cbcSMatt Macy#   CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is
51eda14cbcSMatt Macy#   deprecated. They have the same value.
52eda14cbcSMatt Macy#
53eda14cbcSMatt Macy#   This code was derived from Makefile.decl in GLib, originally licensed
54eda14cbcSMatt Macy#   under LGPLv2.1+.
55eda14cbcSMatt Macy#
56eda14cbcSMatt Macy# LICENSE
57eda14cbcSMatt Macy#
58eda14cbcSMatt Macy#   Copyright (c) 2012, 2016 Philip Withnall
59eda14cbcSMatt Macy#   Copyright (c) 2012 Xan Lopez
60eda14cbcSMatt Macy#   Copyright (c) 2012 Christian Persch
61eda14cbcSMatt Macy#   Copyright (c) 2012 Paolo Borelli
62eda14cbcSMatt Macy#   Copyright (c) 2012 Dan Winship
63eda14cbcSMatt Macy#   Copyright (c) 2015 Bastien ROUCARIES
64eda14cbcSMatt Macy#
65eda14cbcSMatt Macy#   This library is free software; you can redistribute it and/or modify it
66eda14cbcSMatt Macy#   under the terms of the GNU Lesser General Public License as published by
67eda14cbcSMatt Macy#   the Free Software Foundation; either version 2.1 of the License, or (at
68eda14cbcSMatt Macy#   your option) any later version.
69eda14cbcSMatt Macy#
70eda14cbcSMatt Macy#   This library is distributed in the hope that it will be useful, but
71eda14cbcSMatt Macy#   WITHOUT ANY WARRANTY; without even the implied warranty of
72eda14cbcSMatt Macy#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
73eda14cbcSMatt Macy#   General Public License for more details.
74eda14cbcSMatt Macy#
75eda14cbcSMatt Macy#   You should have received a copy of the GNU Lesser General Public License
76eda14cbcSMatt Macy#   along with this program. If not, see <https://www.gnu.org/licenses/>.
77eda14cbcSMatt Macy
78eda14cbcSMatt Macy#serial 25
79eda14cbcSMatt Macy
80eda14cbcSMatt MacyAC_DEFUN([AX_CODE_COVERAGE],[
81eda14cbcSMatt Macy	dnl Check for --enable-code-coverage
82eda14cbcSMatt Macy	AC_REQUIRE([AC_PROG_SED])
83eda14cbcSMatt Macy
84eda14cbcSMatt Macy	# allow to override gcov location
85eda14cbcSMatt Macy	AC_ARG_WITH([gcov],
86eda14cbcSMatt Macy	  [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])],
87eda14cbcSMatt Macy	  [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov],
88eda14cbcSMatt Macy	  [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov])
89eda14cbcSMatt Macy
90eda14cbcSMatt Macy	AC_MSG_CHECKING([whether to build with code coverage support])
91eda14cbcSMatt Macy	AC_ARG_ENABLE([code-coverage],
92eda14cbcSMatt Macy	  AS_HELP_STRING([--enable-code-coverage],
93eda14cbcSMatt Macy	  [Whether to enable code coverage support]),,
94eda14cbcSMatt Macy	  enable_code_coverage=no)
95eda14cbcSMatt Macy
96eda14cbcSMatt Macy	AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
97eda14cbcSMatt Macy	AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
98eda14cbcSMatt Macy	AC_MSG_RESULT($enable_code_coverage)
99eda14cbcSMatt Macy
100eda14cbcSMatt Macy	AS_IF([ test "$enable_code_coverage" = "yes" ], [
101eda14cbcSMatt Macy		# check for gcov
102eda14cbcSMatt Macy		AC_CHECK_TOOL([GCOV],
103eda14cbcSMatt Macy		  [$_AX_CODE_COVERAGE_GCOV_PROG_WITH],
104eda14cbcSMatt Macy		  [:])
105eda14cbcSMatt Macy		AS_IF([test "X$GCOV" = "X:"],
106eda14cbcSMatt Macy		  [AC_MSG_ERROR([gcov is needed to do coverage])])
107eda14cbcSMatt Macy		AC_SUBST([GCOV])
108eda14cbcSMatt Macy
109eda14cbcSMatt Macy		dnl Check if gcc is being used
110eda14cbcSMatt Macy		AS_IF([ test "$GCC" = "no" ], [
111eda14cbcSMatt Macy			AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
112eda14cbcSMatt Macy		])
113eda14cbcSMatt Macy
114eda14cbcSMatt Macy		AC_CHECK_PROG([LCOV], [lcov], [lcov])
115eda14cbcSMatt Macy		AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
116eda14cbcSMatt Macy
117eda14cbcSMatt Macy		AS_IF([ test -z "$LCOV" ], [
118eda14cbcSMatt Macy			AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed])
119eda14cbcSMatt Macy		])
120eda14cbcSMatt Macy
121eda14cbcSMatt Macy		AS_IF([ test -z "$GENHTML" ], [
122eda14cbcSMatt Macy			AC_MSG_ERROR([Could not find genhtml from the lcov package])
123eda14cbcSMatt Macy		])
124eda14cbcSMatt Macy
125eda14cbcSMatt Macy		dnl Build the code coverage flags
126eda14cbcSMatt Macy		dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility
127eda14cbcSMatt Macy		CODE_COVERAGE_CPPFLAGS=""
128eda14cbcSMatt Macy		CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
129eda14cbcSMatt Macy		CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
130eda14cbcSMatt Macy		CODE_COVERAGE_LIBS="-lgcov"
131eda14cbcSMatt Macy		CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS"
132eda14cbcSMatt Macy
133eda14cbcSMatt Macy		AC_SUBST([CODE_COVERAGE_CPPFLAGS])
134eda14cbcSMatt Macy		AC_SUBST([CODE_COVERAGE_CFLAGS])
135eda14cbcSMatt Macy		AC_SUBST([CODE_COVERAGE_CXXFLAGS])
136eda14cbcSMatt Macy		AC_SUBST([CODE_COVERAGE_LIBS])
137eda14cbcSMatt Macy		AC_SUBST([CODE_COVERAGE_LDFLAGS])
138eda14cbcSMatt Macy
139eda14cbcSMatt Macy		[CODE_COVERAGE_RULES_CHECK='
140eda14cbcSMatt Macy	-$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
141eda14cbcSMatt Macy	$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
142eda14cbcSMatt Macy']
143eda14cbcSMatt Macy		[CODE_COVERAGE_RULES_CAPTURE='
144eda14cbcSMatt Macy	$(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
145eda14cbcSMatt Macy	$(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
146eda14cbcSMatt Macy	-@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
147eda14cbcSMatt Macy	$(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
148eda14cbcSMatt Macy	@echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
149eda14cbcSMatt Macy']
150eda14cbcSMatt Macy		[CODE_COVERAGE_RULES_CLEAN='
151eda14cbcSMatt Macyclean: code-coverage-clean
152eda14cbcSMatt Macydistclean: code-coverage-clean
153eda14cbcSMatt Macycode-coverage-clean:
154eda14cbcSMatt Macy	-$(LCOV) --directory $(top_builddir) -z
155eda14cbcSMatt Macy	-rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
156eda14cbcSMatt Macy	-find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
157eda14cbcSMatt Macy']
158eda14cbcSMatt Macy	], [
159eda14cbcSMatt Macy		[CODE_COVERAGE_RULES_CHECK='
160eda14cbcSMatt Macy	@echo "Need to reconfigure with --enable-code-coverage"
161eda14cbcSMatt Macy']
162eda14cbcSMatt Macy		CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK"
163eda14cbcSMatt Macy		CODE_COVERAGE_RULES_CLEAN=''
164eda14cbcSMatt Macy	])
165eda14cbcSMatt Macy
166eda14cbcSMatt Macy[CODE_COVERAGE_RULES='
167eda14cbcSMatt Macy# Code coverage
168eda14cbcSMatt Macy#
169eda14cbcSMatt Macy# Optional:
170eda14cbcSMatt Macy#  - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
171eda14cbcSMatt Macy#    Multiple directories may be specified, separated by whitespace.
172eda14cbcSMatt Macy#    (Default: $(top_builddir))
173eda14cbcSMatt Macy#  - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
174eda14cbcSMatt Macy#    by lcov for code coverage. (Default:
175eda14cbcSMatt Macy#    $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
176eda14cbcSMatt Macy#  - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
177eda14cbcSMatt Macy#    reports to be created. (Default:
178eda14cbcSMatt Macy#    $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
179eda14cbcSMatt Macy#  - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage,
180eda14cbcSMatt Macy#    set to 0 to disable it and leave empty to stay with the default.
181eda14cbcSMatt Macy#    (Default: empty)
182eda14cbcSMatt Macy#  - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov
183eda14cbcSMatt Macy#    instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
184eda14cbcSMatt Macy#  - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov
185eda14cbcSMatt Macy#    instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
186eda14cbcSMatt Macy#  - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov
187eda14cbcSMatt Macy#  - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the
188eda14cbcSMatt Macy#    collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
189eda14cbcSMatt Macy#  - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov
190eda14cbcSMatt Macy#    instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
191eda14cbcSMatt Macy#  - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering
192eda14cbcSMatt Macy#    lcov instance. (Default: empty)
193eda14cbcSMatt Macy#  - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov
194eda14cbcSMatt Macy#    instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
195eda14cbcSMatt Macy#  - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the
196eda14cbcSMatt Macy#    genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
197eda14cbcSMatt Macy#  - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
198eda14cbcSMatt Macy#    instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
199eda14cbcSMatt Macy#  - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
200eda14cbcSMatt Macy#
201eda14cbcSMatt Macy# The generated report will be titled using the $(PACKAGE_NAME) and
202eda14cbcSMatt Macy# $(PACKAGE_VERSION). In order to add the current git hash to the title,
203eda14cbcSMatt Macy# use the git-version-gen script, available online.
204eda14cbcSMatt Macy
205eda14cbcSMatt Macy# Optional variables
206eda14cbcSMatt MacyCODE_COVERAGE_DIRECTORY ?= $(top_builddir)
207eda14cbcSMatt MacyCODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
208eda14cbcSMatt MacyCODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
209eda14cbcSMatt MacyCODE_COVERAGE_BRANCH_COVERAGE ?=
210eda14cbcSMatt MacyCODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
211eda14cbcSMatt Macy--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
212eda14cbcSMatt MacyCODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
213eda14cbcSMatt MacyCODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)"
214eda14cbcSMatt MacyCODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
215eda14cbcSMatt MacyCODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
216eda14cbcSMatt MacyCODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?=
217eda14cbcSMatt MacyCODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
218eda14cbcSMatt MacyCODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\
219eda14cbcSMatt Macy$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
220eda14cbcSMatt Macy--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
221eda14cbcSMatt MacyCODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
222eda14cbcSMatt Macy
223eda14cbcSMatt Macy# Add any folders you want to ignore here
224eda14cbcSMatt Macy# Ignore tmp and tests themselves
225eda14cbcSMatt MacyCODE_COVERAGE_IGNORE_PATTERN ?= "/tmp/*" "*/tests/*"
226eda14cbcSMatt MacyCODE_COVERAGE_IGNORE_PATTERN += "*/module/zstd/lib/*"
227*e92ffd9bSMartin MatuskaCODE_COVERAGE_IGNORE_PATTERN += "*/module/zfs/lz4.c"
228eda14cbcSMatt Macy
229eda14cbcSMatt MacyGITIGNOREFILES ?=
230eda14cbcSMatt MacyGITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
231eda14cbcSMatt Macy
232eda14cbcSMatt Macycode_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
233eda14cbcSMatt Macycode_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY))
234eda14cbcSMatt Macycode_coverage_v_lcov_cap_0 = @echo "  LCOV   --capture"\
235eda14cbcSMatt Macy $(CODE_COVERAGE_OUTPUT_FILE);
236eda14cbcSMatt Macycode_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
237eda14cbcSMatt Macycode_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
238eda14cbcSMatt Macycode_coverage_v_lcov_ign_0 = @echo "  LCOV   --remove /tmp/*"\
239eda14cbcSMatt Macy $(CODE_COVERAGE_IGNORE_PATTERN);
240eda14cbcSMatt Macycode_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
241eda14cbcSMatt Macycode_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
242eda14cbcSMatt Macycode_coverage_v_genhtml_0 = @echo "  GEN   " $(CODE_COVERAGE_OUTPUT_DIRECTORY);
243eda14cbcSMatt Macycode_coverage_quiet = $(code_coverage_quiet_$(V))
244eda14cbcSMatt Macycode_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
245eda14cbcSMatt Macycode_coverage_quiet_0 = --quiet
246eda14cbcSMatt Macy
247eda14cbcSMatt Macy# sanitizes the test-name: replaces with underscores: dashes and dots
248eda14cbcSMatt Macycode_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
249eda14cbcSMatt Macy
250eda14cbcSMatt Macy# Use recursive makes in order to ignore errors during check
251eda14cbcSMatt Macycheck-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"'
252eda14cbcSMatt Macy
253eda14cbcSMatt Macy# Capture code coverage data
254eda14cbcSMatt Macycode-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"'
255eda14cbcSMatt Macy
256eda14cbcSMatt Macy# Hook rule executed before code-coverage-capture, overridable by the user
257eda14cbcSMatt Macycode-coverage-capture-hook:
258eda14cbcSMatt Macy
259eda14cbcSMatt Macy'"$CODE_COVERAGE_RULES_CLEAN"'
260eda14cbcSMatt Macy
261eda14cbcSMatt MacyA''M_DISTCHECK_CONFIGURE_FLAGS ?=
262eda14cbcSMatt MacyA''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
263eda14cbcSMatt Macy
264eda14cbcSMatt Macy.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
265eda14cbcSMatt Macy']
266eda14cbcSMatt Macy
267eda14cbcSMatt Macy	AC_SUBST([CODE_COVERAGE_RULES])
268eda14cbcSMatt Macy	m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
269eda14cbcSMatt Macy])
270