[2/3] Consolidate custom clean targets for coverage files
Commit Message
As reported by Mark:
Since b2f225d6b ("Consolidate and add files to clean target variables")
autoreconf (automake) produces these warnings:
debuginfod/Makefile.am:130: warning: CLEANFILES multiply defined in condition TRUE ...
config/eu.am:138: ... 'CLEANFILES' previously defined here
debuginfod/Makefile.am:32: 'config/eu.am' included from here
libasm/Makefile.am:91: warning: CLEANFILES multiply defined in condition TRUE ...
config/eu.am:138: ... 'CLEANFILES' previously defined here
libasm/Makefile.am:30: 'config/eu.am' included from here
libcpu/Makefile.am:105: warning: CLEANFILES multiply defined in condition TRUE ...
config/eu.am:138: ... 'CLEANFILES' previously defined here
libcpu/Makefile.am:30: 'config/eu.am' included from here
libdw/Makefile.am:156: warning: CLEANFILES multiply defined in condition TRUE ...
config/eu.am:138: ... 'CLEANFILES' previously defined here
libdw/Makefile.am:30: 'config/eu.am' included from here
libelf/Makefile.am:142: warning: CLEANFILES multiply defined in condition TRUE ...
config/eu.am:138: ... 'CLEANFILES' previously defined here
libelf/Makefile.am:30: 'config/eu.am' included from here
src/Makefile.am:47: warning: CLEANFILES multiply defined in condition TRUE ...
config/eu.am:138: ... 'CLEANFILES' previously defined here
src/Makefile.am:19: 'config/eu.am' included from here
tests/Makefile.am:891: warning: CLEANFILES multiply defined in condition TRUE ...
config/eu.am:138: ... 'CLEANFILES' previously defined here
tests/Makefile.am:19: 'config/eu.am' included from here
This is because config/eu.am defines a default "CLEANFILES".
However, the list is only for the removal of coverage files.
Since there is an exising custom clean rule for coverage in Makefile.am
because there is a directory involved as well as files,
further simplification of these rule definitions can resolve this.
Define cleaning targets for coverage files
in a single place and as a common definition
for all generated Makefiles using a custom rule.
This allows for avoiding the use of "CLEANFILES"
variables for anything related to removing coverage files,
and removing the usage of this variable where there is a conflict,
as it is no longer needed to be defined there.
* Makefile.am: remove variables and custom clean target.
* config/eu.am: remove clean variables, add variables
and custom clean target based on removed definitions.
Fixes: b2f225d6b ("Consolidate and add files to clean target variables")
Reported-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Michael Pratt <mcpratt@pm.me>
---
Makefile.am | 13 +------------
config/eu.am | 9 ++++++++-
2 files changed, 9 insertions(+), 13 deletions(-)
@@ -55,8 +55,6 @@ rpmbuild: dist
if GCOV
-COVERAGE_OUTPUT_FILE = $(PACKAGE_NAME).lcov
-COVERAGE_OUTPUT_DIRECTORY = coverage
COVERAGE_OUTPUT_INDEX_HTML = $(COVERAGE_OUTPUT_DIRECTORY)/index.html
COVERAGE_TITLE = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
@@ -66,16 +64,7 @@ build_COVERAGE_DIRS = $(patsubst %,$(builddir)/%,$(COVERAGE_DIRS))
all_COVERAGE_DIRS = $(sort $(src_COVERAGE_DIRS) $(build_COVERAGE_DIRS))
LCOV_DIRS_ARGS = $(patsubst %,--directory=%,$(all_COVERAGE_DIRS))
-CLEANFILES = $(COVERAGE_OUTPUT_FILE)
-
-.PHONY: coverage coverage-clean
-
-clean-local: coverage-clean
-distclean-local: coverage-clean
-
-coverage-clean:
- -rm -rf $(COVERAGE_OUTPUT_DIRECTORY)
-
+.PHONY: coverage
coverage: $(COVERAGE_OUTPUT_INDEX_HTML)
@echo 'file://$(abs_builddir)/$(COVERAGE_OUTPUT_INDEX_HTML)'
@@ -135,7 +135,14 @@ else
$(AM_V_CC)$(COMPILE.os) -c -o $@ $(fpic_CFLAGS) $(DEFS.os) $<
endif
-CLEANFILES = *.gcno *.gcda
+COVERAGE_OUTPUT_DIRECTORY = coverage
+COVERAGE_OUTPUT_FILE = $(PACKAGE_NAME).lcov
+
+.PHONY: clean-coverage
+clean-local: clean-coverage
+clean-coverage:
+ -rm -rf $(COVERAGE_OUTPUT_DIRECTORY)
+ -rm -f $(COVERAGE_OUTPUT_FILE) *.gcno *.gcda
textrel_msg = echo "WARNING: TEXTREL found in '$@'"
if FATAL_TEXTREL