Autoools silent-rules fixes
cover Autoools silent-rules fixes
The build system defines variables similar to the ones automake provides to control the verbosity of the build. However, the iptables implemen- tation is only partially effective and was written fifteen years ago. This patch-set brings the variable definitions in line with the current automake recommendations and fixes some bugs.
Patch 1 contains some unrelated formatting changes. Patches 2 & 3 remove some unused variables. Patch 4 brings the remaining ones in line with automake. Patch 5 adds a new variable for ln.
Patches 6 & 7 fix some problems with the man-page rules.
Jeremy Sowden (7):
build: format AM_CPPFLAGS variables
build: remove obsolete AM_LIBTOOL_SILENT variable
build: remove unused AM_VERBOSE_CXX* variables
build: use standard automake verbosity variables
build: add an automake verbosity variable for ln
build: replace echo -e with printf
build: suppress man-page listing in silent rules
extensions/GNUmakefile.in | 79 ++++++++++++++++++++++++--------------- iptables/Makefile.am | 15 ++++++-- 2 files changed, 60 insertions(+), 34 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/7 build: format `AM_CPPFLAGS` variables
--- extensions/GNUmakefile.in | 10 +++++++++- iptables/Makefile.am | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-)
extensions/GNUmakefile.in +9 -1
@@ -22,7 +22,15 @@ regular_CPPFLAGS = @regular_CPPFLAGS@ kinclude_CPPFLAGS = @kinclude_CPPFLAGS@ AM_CFLAGS = ${regular_CFLAGS} -AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_builddir} -I${top_srcdir}/include -I${top_srcdir} ${kinclude_CPPFLAGS} ${CPPFLAGS} @libnetfilter_conntrack_CFLAGS@ @libnftnl_CFLAGS@ +AM_CPPFLAGS = ${regular_CPPFLAGS} \ + -I${top_builddir}/include \ + -I${top_builddir} \ + -I${top_srcdir}/include \ + -I${top_srcdir} \ + ${kinclude_CPPFLAGS} \ + ${CPPFLAGS} \ + @libnetfilter_conntrack_CFLAGS@ \ + @libnftnl_CFLAGS@ AM_DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@ AM_LDFLAGS = @noundef_LDFLAGS@ @regular_LDFLAGS@
iptables/Makefile.am +8 -1
@@ -1,7 +1,14 @@ # -*- Makefile -*- AM_CFLAGS = ${regular_CFLAGS} -AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_srcdir}/include -I${top_srcdir} ${kinclude_CPPFLAGS} ${libmnl_CFLAGS} ${libnftnl_CFLAGS} ${libnetfilter_conntrack_CFLAGS} +AM_CPPFLAGS = ${regular_CPPFLAGS} \ + -I${top_builddir}/include \ + -I${top_srcdir}/include \ + -I${top_srcdir} \ + ${kinclude_CPPFLAGS} \ + ${libmnl_CFLAGS} \ + ${libnftnl_CFLAGS} \ + ${libnetfilter_conntrack_CFLAGS} AM_LDFLAGS = ${regular_LDFLAGS} BUILT_SOURCES =
Signature · 1 line
2.43.0
PATCH 2/7 build: remove obsolete `AM_LIBTOOL_SILENT` variable
In reply to Jeremy SowdenIt doesn't do anything, so get rid of it.
--- extensions/GNUmakefile.in | 1 - 1 file changed, 1 deletion(-)
extensions/GNUmakefile.in +0 -1
@@ -35,7 +35,6 @@ AM_DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@ AM_LDFLAGS = @noundef_LDFLAGS@ @regular_LDFLAGS@ ifeq (${V},) -AM_LIBTOOL_SILENT = --silent AM_VERBOSE_CC = @echo " CC " $@; AM_VERBOSE_CCLD = @echo " CCLD " $@; AM_VERBOSE_CXX = @echo " CXX " $@;
Signature · 1 line
2.43.0
PATCH 3/7 build: remove unused `AM_VERBOSE_CXX*` variables
In reply to Jeremy SowdenThere is no C++, so these variables are not required.
--- extensions/GNUmakefile.in | 2 -- 1 file changed, 2 deletions(-)
extensions/GNUmakefile.in +0 -2
@@ -37,8 +37,6 @@ AM_LDFLAGS = @noundef_LDFLAGS@ @regular_LDFLAGS@ ifeq (${V},) AM_VERBOSE_CC = @echo " CC " $@; AM_VERBOSE_CCLD = @echo " CCLD " $@; -AM_VERBOSE_CXX = @echo " CXX " $@; -AM_VERBOSE_CXXLD = @echo " CXXLD " $@; AM_VERBOSE_AR = @echo " AR " $@; AM_VERBOSE_GEN = @echo " GEN " $@; endif
Signature · 1 line
2.43.0
PATCH 4/7 build: use standard automake verbosity variables
In reply to Jeremy SowdenThe previous implementation ignored the default verbosity defined by configure, and controlled by --{enable,disable}-silent-rules, and treated V="" as V=0. Instead, follow the guide-lines given in the automake manual.
--- extensions/GNUmakefile.in | 41 +++++++++++++++++++++++---------------- iptables/Makefile.am | 6 +++--- 2 files changed, 27 insertions(+), 20 deletions(-)
extensions/GNUmakefile.in +24 -17
@@ -34,12 +34,19 @@ AM_CPPFLAGS = ${regular_CPPFLAGS} \ AM_DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@ AM_LDFLAGS = @noundef_LDFLAGS@ @regular_LDFLAGS@ -ifeq (${V},) -AM_VERBOSE_CC = @echo " CC " $@; -AM_VERBOSE_CCLD = @echo " CCLD " $@; -AM_VERBOSE_AR = @echo " AR " $@; -AM_VERBOSE_GEN = @echo " GEN " $@; -endif +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +am__v_AR_0 = @echo " AR " $@; +am__v_CC_0 = @echo " CC " $@; +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_GEN_0 = @echo " GEN " $@; +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_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@} # # Wildcard module list
@@ -118,7 +125,7 @@ clean: distclean: clean init%.o: init%.c - ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=$*_init ${CFLAGS} -o $@ -c $<; + ${AM_V_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=$*_init ${CFLAGS} -o $@ -c $<; -include .*.d
@@ -127,10 +134,10 @@ init%.o: init%.c # Shared libraries # lib%.so: lib%.oo - ${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} ${LDFLAGS} -shared -o $@ $< -L../libxtables/.libs -lxtables ${$*_LIBADD}; + ${AM_V_CCLD} ${CCLD} ${AM_LDFLAGS} ${LDFLAGS} -shared -o $@ $< -L../libxtables/.libs -lxtables ${$*_LIBADD}; lib%.oo: ${srcdir}/lib%.c - ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=lib$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<; + ${AM_V_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=lib$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<; libxt_NOTRACK.so: libxt_CT.so ln -fs $< $@
@@ -158,22 +165,22 @@ xt_connlabel_LIBADD = @libnetfilter_conntrack_LIBS@ # handling code in the Makefiles. # lib%.o: ${srcdir}/lib%.c - ${AM_VERBOSE_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -DNO_SHARED_LIBS=1 -D_INIT=lib$*_init ${CFLAGS} -o $@ -c $<; + ${AM_V_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -DNO_SHARED_LIBS=1 -D_INIT=lib$*_init ${CFLAGS} -o $@ -c $<; libext.a: initext.o ${libext_objs} - ${AM_VERBOSE_AR} ${AR} crs $@ $^; + ${AM_V_AR} ${AR} crs $@ $^; libext_ebt.a: initextb.o ${libext_ebt_objs} - ${AM_VERBOSE_AR} ${AR} crs $@ $^; + ${AM_V_AR} ${AR} crs $@ $^; libext_arpt.a: initexta.o ${libext_arpt_objs} - ${AM_VERBOSE_AR} ${AR} crs $@ $^; + ${AM_V_AR} ${AR} crs $@ $^; libext4.a: initext4.o ${libext4_objs} - ${AM_VERBOSE_AR} ${AR} crs $@ $^; + ${AM_V_AR} ${AR} crs $@ $^; libext6.a: initext6.o ${libext6_objs} - ${AM_VERBOSE_AR} ${AR} crs $@ $^; + ${AM_V_AR} ${AR} crs $@ $^; initext_func := $(addprefix xt_,${pfx_build_mod}) initextb_func := $(addprefix ebt_,${pfb_build_mod})
@@ -191,7 +198,7 @@ ${initext_depfiles}: FORCE rm -f [email protected]; ${initext_sources}: %.c: .%.dd - ${AM_VERBOSE_GEN} + ${AM_V_GEN} @( \ initext_func="$(value $(basename $@)_func)"; \ funcname="init_extensions$(patsubst initext%.c,%,$@)"; \
@@ -214,7 +221,7 @@ ${initext_sources}: %.c: .%.dd 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 = \ - ${AM_VERBOSE_GEN} \ + ${AM_V_GEN} \ for ext in $(sort ${1}); do \ f="${srcdir}/libxt_$$ext.man"; \ if [ -f "$$f" ]; then \
iptables/Makefile.am +3 -3
@@ -114,15 +114,15 @@ x_sbin_links = iptables-nft iptables-nft-restore iptables-nft-save \ endif iptables-extensions.8: iptables-extensions.8.tmpl ../extensions/matches.man ../extensions/targets.man - ${AM_VERBOSE_GEN} sed \ + ${AM_V_GEN} sed \ -e '/@MATCH@/ r ../extensions/matches.man' \ -e '/@TARGET@/ r ../extensions/targets.man' $< >$@; ${xlate_man_links}: - ${AM_VERBOSE_GEN} echo '.so man8/xtables-translate.8' >$@ + ${AM_V_GEN} echo '.so man8/xtables-translate.8' >$@ ip6tables.8 ip6tables-apply.8 ip6tables-restore.8 ip6tables-save.8: - ${AM_VERBOSE_GEN} echo "$@" | sed 's|^ip6|.so man8/ip|' >$@ + ${AM_V_GEN} echo "$@" | sed 's|^ip6|.so man8/ip|' >$@ pkgconfig_DATA = xtables.pc
Signature · 1 line
2.43.0
PATCH 5/7 build: add an automake verbosity variable for `ln`
In reply to Jeremy Sowden--- extensions/GNUmakefile.in | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
extensions/GNUmakefile.in +9 -6
@@ -39,14 +39,17 @@ am__v_AR_0 = @echo " AR " $@; 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_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_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@} # # Wildcard module list
@@ -140,17 +143,17 @@ lib%.oo: ${srcdir}/lib%.c ${AM_V_CC} ${CC} ${AM_CPPFLAGS} ${AM_DEPFLAGS} ${AM_CFLAGS} -D_INIT=lib$*_init -DPIC -fPIC ${CFLAGS} -o $@ -c $<; libxt_NOTRACK.so: libxt_CT.so - ln -fs $< $@ + ${AM_V_LN} ln -fs $< $@ libxt_state.so: libxt_conntrack.so - ln -fs $< $@ + ${AM_V_LN} ln -fs $< $@ libxt_REDIRECT.so: libxt_NAT.so - ln -fs $< $@ + ${AM_V_LN} ln -fs $< $@ libxt_MASQUERADE.so: libxt_NAT.so - ln -fs $< $@ + ${AM_V_LN} ln -fs $< $@ libxt_SNAT.so: libxt_NAT.so - ln -fs $< $@ + ${AM_V_LN} ln -fs $< $@ libxt_DNAT.so: libxt_NAT.so - ln -fs $< $@ + ${AM_V_LN} ln -fs $< $@ # Need the LIBADDs in iptables/Makefile.am too for libxtables_la_LIBADD xt_RATEEST_LIBADD = -lm
Signature · 1 line
2.43.0
PATCH 6/7 build: replace `echo -e` with `printf`
In reply to Jeremy Sowdenecho -e is not portable and we can end up with:
GEN matches.man
-e + ./libxt_addrtype.man
-e + ./libip6t_ah.man
-e + ./libipt_ah.man
-e + ./libxt_bpf.man
-e + ./libxt_cgroup.man
-e + ./libxt_cluster.man
-e + ./libxt_comment.man
-e + ./libxt_connbytes.man
-e + ./libxt_connlabel.man
-e + ./libxt_connlimit.man
-e + ./libxt_connmark.man
-e + ./libxt_conntrack.man
[...]
--- extensions/GNUmakefile.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
extensions/GNUmakefile.in +3 -3
@@ -228,19 +228,19 @@ man_run = \ for ext in $(sort ${1}); do \ f="${srcdir}/libxt_$$ext.man"; \ if [ -f "$$f" ]; then \ - echo -e "\t+ $$f" >&2; \ + printf "\t+ $$f" >&2; \ echo ".SS $$ext"; \ cat "$$f" || exit $$?; \ fi; \ f="${srcdir}/libip6t_$$ext.man"; \ if [ -f "$$f" ]; then \ - echo -e "\t+ $$f" >&2; \ + printf "\t+ $$f" >&2; \ echo ".SS $$ext (IPv6-specific)"; \ cat "$$f" || exit $$?; \ fi; \ f="${srcdir}/libipt_$$ext.man"; \ if [ -f "$$f" ]; then \ - echo -e "\t+ $$f" >&2; \ + printf "\t+ $$f" >&2; \ echo ".SS $$ext (IPv4-specific)"; \ cat "$$f" || exit $$?; \ fi; \
Signature · 1 line
2.43.0
Re: [PATCH iptables 6/7] build: replace `echo -e` with `printf`
Quoted 53 lines · Jeremy Sowden
echo -eis not portable and we can end up with:GEN matches.man
-e + ./libxt_addrtype.man
-e + ./libip6t_ah.man
-e + ./libipt_ah.man
-e + ./libxt_bpf.man
-e + ./libxt_cgroup.man
-e + ./libxt_cluster.man
-e + ./libxt_comment.man
-e + ./libxt_connbytes.man
-e + ./libxt_connlabel.man
-e + ./libxt_connlimit.man
-e + ./libxt_connmark.man
-e + ./libxt_conntrack.man
[...]Signed-off-by Jeremy Sowden <[email protected]>--- extensions/GNUmakefile.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)extensions/GNUmakefile.in +3
-3@@ -228,19 +228,19 @@ man_run = \ for ext in $(sort ${1}); do \ f="${srcdir}/libxt_$$ext.man"; \ if [ -f "$$f" ]; then \ - echo -e "\t+ $$f" >&2; \ + printf "\t+ $$f" >&2; \ echo ".SS $$ext"; \ cat "$$f" || exit $$?; \ fi; \ f="${srcdir}/libip6t_$$ext.man"; \ if [ -f "$$f" ]; then \ - echo -e "\t+ $$f" >&2; \ + printf "\t+ $$f" >&2; \ echo ".SS $$ext (IPv6-specific)"; \ cat "$$f" || exit $$?; \ fi; \ f="${srcdir}/libipt_$$ext.man"; \ if [ -f "$$f" ]; then \ - echo -e "\t+ $$f" >&2; \ + printf "\t+ $$f" >&2; \ echo ".SS $$ext (IPv4-specific)"; \ cat "$$f" || exit $$?; \ fi; \Signature · 1 line
2.43.0
Just noticed that there should be newlines in the printf commands. Will resend.
J.
PATCH 7/7 build: suppress man-page listing in silent rules
In reply to Jeremy SowdenAdd 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.
--- extensions/GNUmakefile.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
extensions/GNUmakefile.in +7 -3
@@ -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; \
Signature · 1 line
2.43.0
Re: [PATCH iptables 7/7] build: suppress man-page listing in silent rules
Quoted 11 lines · Jeremy Sowden
Add an
AM_V_PRINTFvariable to control whetherprintfis 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
printfcommands _within_ a rule,AM_V_PRINTFworks be prepending:to theprintfcommand.
extensions/GNUmakefile.in man_run = \ · line 235
Quoted 5 lines
extensions/GNUmakefile.in +1
-1@@ -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.]
Re: [PATCH iptables 7/7] build: suppress man-page listing in silent rules
Quoted 11 lines · Jan Engelhardt
Quoted 9 lines · Jeremy Sowden
Add an
AM_V_PRINTFvariable to control whetherprintfis 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
printfcommands _within_ a rule,AM_V_PRINTFworks be prepending:to theprintfcommand.
Quoted 8 lines
extensions/GNUmakefile.in man_run = \ · line 235
Quoted 6 lines
extensions/GNUmakefile.in +1
-1@@ -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.
Quoted 9 lines
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.