diff mbox series

[iptables,7/7] build: suppress man-page listing in silent rules

Message ID 20231214125927.925993-8-jeremy@azazel.net
State Changes Requested
Headers show
Series Autoools silent-rules fixes | expand

Commit Message

Jeremy Sowden Dec. 14, 2023, 12:59 p.m. UTC
Add an `AM_V_PRINTF` variable to control whether `printf` is called.

Normally `AM_V_*` variables work by prepending

  @echo blah;

to a whole rule to replace the usual output with something briefer.
Since, in this case, the aim is to suppress `printf` commands _within_ a
rule, `AM_V_PRINTF` works be prepending `:` to the `printf` command.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
---
 extensions/GNUmakefile.in | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Jan Engelhardt Dec. 14, 2023, 2:32 p.m. UTC | #1
On Thursday 2023-12-14 13:59, Jeremy Sowden wrote:

>Add an `AM_V_PRINTF` variable to control whether `printf` is called.
>
>Normally `AM_V_*` variables work by prepending
>
>  @echo blah;
>
>to a whole rule to replace the usual output with something briefer.
>Since, in this case, the aim is to suppress `printf` commands _within_ a
>rule, `AM_V_PRINTF` works be prepending `:` to the `printf` command.

>@@ -228,19 +232,19 @@ man_run    = \
> 	for ext in $(sort ${1}); do \
> 		f="${srcdir}/libxt_$$ext.man"; \
> 		if [ -f "$$f" ]; then \
>-			printf "\t+ $$f" >&2; \
>+			${AM_V_PRINTF} printf "\t+ $$f" >&2; \

I believe I was the author of this "for" block.

The intent of V=0 is to hide long build commands and show only the
output name. That works for most people most of the time. It did not
for me in this very build step. ${1}, i.e. the sections, are
dependent on configure options like --disable-ipv4/--disable-ipv6, so
I felt it made sense not only to print the output name (as V=0 does)
but also the source names—but still not the verbose build command.

With that original goal in mind, silencing echo/printf inside this
recipe, for the usecase of V=0, is incorrect.

[Patches 1 to 6 are fine by me.]
Jeremy Sowden Dec. 14, 2023, 3:21 p.m. UTC | #2
On 2023-12-14, at 15:32:26 +0100, Jan Engelhardt wrote:
> On Thursday 2023-12-14 13:59, Jeremy Sowden wrote:
> >Add an `AM_V_PRINTF` variable to control whether `printf` is called.
> >
> >Normally `AM_V_*` variables work by prepending
> >
> >  @echo blah;
> >
> >to a whole rule to replace the usual output with something briefer.
> >Since, in this case, the aim is to suppress `printf` commands _within_ a
> >rule, `AM_V_PRINTF` works be prepending `:` to the `printf` command.
> 
> >@@ -228,19 +232,19 @@ man_run    = \
> > 	for ext in $(sort ${1}); do \
> > 		f="${srcdir}/libxt_$$ext.man"; \
> > 		if [ -f "$$f" ]; then \
> >-			printf "\t+ $$f" >&2; \
> >+			${AM_V_PRINTF} printf "\t+ $$f" >&2; \
> 
> I believe I was the author of this "for" block.

Indeed you were.

> The intent of V=0 is to hide long build commands and show only the
> output name. That works for most people most of the time. It did not
> for me in this very build step. ${1}, i.e. the sections, are
> dependent on configure options like --disable-ipv4/--disable-ipv6, so
> I felt it made sense not only to print the output name (as V=0 does)
> but also the source names—but still not the verbose build command.
> 
> With that original goal in mind, silencing echo/printf inside this
> recipe, for the usecase of V=0, is incorrect.

Ah, I see.  Let's leave it as it is then.

J.
diff mbox series

Patch

diff --git a/extensions/GNUmakefile.in b/extensions/GNUmakefile.in
index f41af7c1420d..24ec57f7d1cb 100644
--- a/extensions/GNUmakefile.in
+++ b/extensions/GNUmakefile.in
@@ -40,16 +40,19 @@  am__v_CC_0           = @echo "  CC      " $@;
 am__v_CCLD_0         = @echo "  CCLD    " $@;
 am__v_GEN_0          = @echo "  GEN     " $@;
 am__v_LN_0           = @echo "  LN      " $@;
+am__v_PRINTF_0       = :
 am__v_AR_            = ${am__v_AR_@AM_DEFAULT_V@}
 am__v_CC_            = ${am__v_CC_@AM_DEFAULT_V@}
 am__v_CCLD_          = ${am__v_CCLD_@AM_DEFAULT_V@}
 am__v_GEN_           = ${am__v_GEN_@AM_DEFAULT_V@}
 am__v_LN_            = ${am__v_LN_@AM_DEFAULT_V@}
+am__v_PRINTF_        = ${am__v_PRINTF_@AM_DEFAULT_V@}
 AM_V_AR              = ${am__v_AR_@AM_V@}
 AM_V_CC              = ${am__v_CC_@AM_V@}
 AM_V_CCLD            = ${am__v_CCLD_@AM_V@}
 AM_V_GEN             = ${am__v_GEN_@AM_V@}
 AM_V_LN              = ${am__v_LN_@AM_V@}
+AM_V_PRINTF          = ${am__v_PRINTF_@AM_V@}
 
 #
 #	Wildcard module list
@@ -221,6 +224,7 @@  ${initext_sources}: %.c: .%.dd
 #
 #	Manual pages
 #
+
 ex_matches = $(shell echo ${1} | LC_ALL=POSIX grep -Eo '\b[[:lower:][:digit:]_]+\b')
 ex_targets = $(shell echo ${1} | LC_ALL=POSIX grep -Eo '\b[[:upper:][:digit:]_]+\b')
 man_run    = \
@@ -228,19 +232,19 @@  man_run    = \
 	for ext in $(sort ${1}); do \
 		f="${srcdir}/libxt_$$ext.man"; \
 		if [ -f "$$f" ]; then \
-			printf "\t+ $$f" >&2; \
+			${AM_V_PRINTF} printf "\t+ $$f" >&2; \
 			echo ".SS $$ext"; \
 			cat "$$f" || exit $$?; \
 		fi; \
 		f="${srcdir}/libip6t_$$ext.man"; \
 		if [ -f "$$f" ]; then \
-			printf "\t+ $$f" >&2; \
+			${AM_V_PRINTF} printf "\t+ $$f" >&2; \
 			echo ".SS $$ext (IPv6-specific)"; \
 			cat "$$f" || exit $$?; \
 		fi; \
 		f="${srcdir}/libipt_$$ext.man"; \
 		if [ -f "$$f" ]; then \
-			printf "\t+ $$f" >&2; \
+			${AM_V_PRINTF} printf "\t+ $$f" >&2; \
 			echo ".SS $$ext (IPv4-specific)"; \
 			cat "$$f" || exit $$?; \
 		fi; \