• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2# aminclude_static.am generated automatically by Autoconf
3# from AX_AM_MACROS_STATIC on Mon May 22 14:23:05 CEST 2023
4
5
6# Code coverage
7#
8# Optional:
9#  - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
10#    Multiple directories may be specified, separated by whitespace.
11#    (Default: $(top_builddir))
12#  - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
13#    by lcov for code coverage. (Default:
14#    $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
15#  - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
16#    reports to be created. (Default:
17#    $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
18#  - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage,
19#    set to 0 to disable it and leave empty to stay with the default.
20#    (Default: empty)
21#  - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov
22#    instances. (Default: based on )
23#  - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov
24#    instances. (Default: )
25#  - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov
26#  - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the
27#    collecting lcov instance. (Default: )
28#  - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov
29#    instance. (Default: )
30#  - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering
31#    lcov instance. (Default: empty)
32#  - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov
33#    instance. (Default: )
34#  - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the
35#    genhtml instance. (Default: based on )
36#  - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
37#    instance. (Default: )
38#  - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
39#
40# The generated report will be titled using the $(PACKAGE_NAME) and
41# $(PACKAGE_VERSION). In order to add the current git hash to the title,
42# use the git-version-gen script, available online.
43# Optional variables
44# run only on top dir
45if CODE_COVERAGE_ENABLED
46 ifeq ($(abs_builddir), $(abs_top_builddir))
47CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
48CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
49CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
50
51CODE_COVERAGE_BRANCH_COVERAGE ?=
52CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
53CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
54CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)"
55CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
56CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
57CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?=
58CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
59CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=$(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
60CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
61CODE_COVERAGE_IGNORE_PATTERN ?=
62
63GITIGNOREFILES := $(GITIGNOREFILES) $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
64code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
65code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY))
66code_coverage_v_lcov_cap_0 = @echo "  LCOV   --capture" $(CODE_COVERAGE_OUTPUT_FILE);
67code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
68code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
69code_coverage_v_lcov_ign_0 = @echo "  LCOV   --remove /tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN);
70code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
71code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
72code_coverage_v_genhtml_0 = @echo "  GEN   " "$(CODE_COVERAGE_OUTPUT_DIRECTORY)";
73code_coverage_quiet = $(code_coverage_quiet_$(V))
74code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
75code_coverage_quiet_0 = --quiet
76
77# sanitizes the test-name: replaces with underscores: dashes and dots
78code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
79
80# Use recursive makes in order to ignore errors during check
81check-code-coverage:
82	-$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
83	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
84
85# Capture code coverage data
86code-coverage-capture: code-coverage-capture-hook
87	$(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)
88	$(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
89	-@rm -f "$(CODE_COVERAGE_OUTPUT_FILE).tmp"
90	$(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)
91	@echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
92
93code-coverage-clean:
94	-$(LCOV) --directory $(top_builddir) -z
95	-rm -rf "$(CODE_COVERAGE_OUTPUT_FILE)" "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "$(CODE_COVERAGE_OUTPUT_DIRECTORY)"
96	-find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
97
98code-coverage-dist-clean:
99
100AM_DISTCHECK_CONFIGURE_FLAGS := $(AM_DISTCHECK_CONFIGURE_FLAGS) --disable-code-coverage
101 else # ifneq ($(abs_builddir), $(abs_top_builddir))
102check-code-coverage:
103
104code-coverage-capture: code-coverage-capture-hook
105
106code-coverage-clean:
107
108code-coverage-dist-clean:
109 endif # ifeq ($(abs_builddir), $(abs_top_builddir))
110else #! CODE_COVERAGE_ENABLED
111# Use recursive makes in order to ignore errors during check
112check-code-coverage:
113	@echo "Need to reconfigure with --enable-code-coverage"
114# Capture code coverage data
115code-coverage-capture: code-coverage-capture-hook
116	@echo "Need to reconfigure with --enable-code-coverage"
117
118code-coverage-clean:
119
120code-coverage-dist-clean:
121
122endif #CODE_COVERAGE_ENABLED
123# Hook rule executed before code-coverage-capture, overridable by the user
124code-coverage-capture-hook:
125
126.PHONY: check-code-coverage code-coverage-capture code-coverage-dist-clean code-coverage-clean code-coverage-capture-hook
127