[3/3] Consolidate list of custom phony targets

Message ID 20241124190223.28061-3-mcpratt@pm.me
State Committed
Headers
Series [1/3] Makefile.am: include common eu.am definitions |

Commit Message

Michael Pratt Nov. 24, 2024, 7:03 p.m. UTC
  Having a target defined as phony within a condition
while another target is always defined as phony
causes an automake warning:

  Makefile.am:67: warning: .PHONY was already defined in condition TRUE, which includes condition GCOV ...
  config/eu.am:141: ... '.PHONY' previously defined here
  Makefile.am:21:   'config/eu.am' included from here
  tests/Makefile.am:895: warning: .PHONY was already defined in condition TRUE, which includes condition GCOV ...
  config/eu.am:141: ... '.PHONY' previously defined here
  tests/Makefile.am:19:   'config/eu.am' included from here

Instead, list all the custom targets that are phony
in the common definitions in the eu.am file.

Since it is all related to coverage at this moment,
the list can be grouped as it is instead of moved or split.

    * Makefile.am: remove .PHONY list in conditional
    * config/eu.am: add coverage target to .PHONY list
    * tests/Makefile.am: remove .PHONY list in conditional

Signed-off-by: Michael Pratt <mcpratt@pm.me>
---
 Makefile.am       | 1 -
 config/eu.am      | 3 ++-
 tests/Makefile.am | 1 -
 3 files changed, 2 insertions(+), 3 deletions(-)
  

Comments

Aaron Merey Jan. 10, 2025, 4:32 p.m. UTC | #1
Hi Michael,

On Sun, Nov 24, 2024 at 2:04 PM Michael Pratt <mcpratt@pm.me> wrote:
>
> Having a target defined as phony within a condition
> while another target is always defined as phony
> causes an automake warning:
>
>   Makefile.am:67: warning: .PHONY was already defined in condition TRUE, which includes condition GCOV ...
>   config/eu.am:141: ... '.PHONY' previously defined here
>   Makefile.am:21:   'config/eu.am' included from here
>   tests/Makefile.am:895: warning: .PHONY was already defined in condition TRUE, which includes condition GCOV ...
>   config/eu.am:141: ... '.PHONY' previously defined here
>   tests/Makefile.am:19:   'config/eu.am' included from here
>
> Instead, list all the custom targets that are phony
> in the common definitions in the eu.am file.
>
> Since it is all related to coverage at this moment,
> the list can be grouped as it is instead of moved or split.
>
>     * Makefile.am: remove .PHONY list in conditional
>     * config/eu.am: add coverage target to .PHONY list
>     * tests/Makefile.am: remove .PHONY list in conditional
>
> Signed-off-by: Michael Pratt <mcpratt@pm.me>
> ---
>  Makefile.am       | 1 -
>  config/eu.am      | 3 ++-
>  tests/Makefile.am | 1 -
>  3 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index e44bbe62..3a181d75 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -64,7 +64,6 @@ 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))
>
> -.PHONY: coverage
>  coverage: $(COVERAGE_OUTPUT_INDEX_HTML)
>         @echo 'file://$(abs_builddir)/$(COVERAGE_OUTPUT_INDEX_HTML)'
>
> diff --git a/config/eu.am b/config/eu.am
> index 475d5836..e4fcbd1a 100644
> --- a/config/eu.am
> +++ b/config/eu.am
> @@ -138,7 +138,8 @@ endif
>  COVERAGE_OUTPUT_DIRECTORY = coverage
>  COVERAGE_OUTPUT_FILE = $(PACKAGE_NAME).lcov
>
> -.PHONY: clean-coverage
> +.PHONY: clean-coverage coverage
> +
>  clean-local: clean-coverage
>  clean-coverage:
>         -rm -rf $(COVERAGE_OUTPUT_DIRECTORY)
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 44cbb825..8f087798 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -892,7 +892,6 @@ CLEANFILES = $(BUILT_SOURCES)
>
>  if GCOV
>  check: check-am coverage
> -.PHONY: coverage
>  coverage:
>         -$(srcdir)/coverage.sh
>  endif
> --
> 2.30.2

Thanks for the patches, I've merged this series.

Aaron
  

Patch

diff --git a/Makefile.am b/Makefile.am
index e44bbe62..3a181d75 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -64,7 +64,6 @@  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))
 
-.PHONY: coverage
 coverage: $(COVERAGE_OUTPUT_INDEX_HTML)
 	@echo 'file://$(abs_builddir)/$(COVERAGE_OUTPUT_INDEX_HTML)'
 
diff --git a/config/eu.am b/config/eu.am
index 475d5836..e4fcbd1a 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -138,7 +138,8 @@  endif
 COVERAGE_OUTPUT_DIRECTORY = coverage
 COVERAGE_OUTPUT_FILE = $(PACKAGE_NAME).lcov
 
-.PHONY: clean-coverage
+.PHONY: clean-coverage coverage
+
 clean-local: clean-coverage
 clean-coverage:
 	-rm -rf $(COVERAGE_OUTPUT_DIRECTORY)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 44cbb825..8f087798 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -892,7 +892,6 @@  CLEANFILES = $(BUILT_SOURCES)
 
 if GCOV
 check: check-am coverage
-.PHONY: coverage
 coverage:
 	-$(srcdir)/coverage.sh
 endif