Skip to contentSkip to conversation

Autoools silent-rules fixes

PATCH In review Jeremy Sowden 2 participants 7 messages Aug 18, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Autoools silent-rules fixes

The build system attempts to extend and make use of the AM_V_* variables that automake provides to control the verbosity of the build. However, there are bugs in the implementation which render it only partially effective. This patch-set updates some of the variable definitions and fixes the bugs.

The first patch is an unrelated include tweak.

Jeremy Sowden (5):
build: use $(top_srcdir) when including Makefile.extra
build: replace AM_V_silent with AM_V_at
build: update AM_V_* definitions to match autotools
build: don't hard-code AM_DEFAULT_VERBOSITY in Makefile.iptrules
build: define AM_V_GEN where it is needed

 Makefile.iptrules.in           | 24 +++++++++---------------
 Makefile.mans.in               |  5 +++++
 extensions/ACCOUNT/Makefile.am |  2 +-
 extensions/Makefile.am         |  8 ++++----
 extensions/pknock/Makefile.am  |  2 +-
 5 files changed, 20 insertions(+), 21 deletions(-)
Signature · 1 line
2.40.1
#1 lore raw

PATCH 1/5 build: use `$(top_srcdir)` when including Makefile.extra

It's less fragile than using hard-coded relative paths.

---
 extensions/ACCOUNT/Makefile.am | 2 +-
 extensions/Makefile.am         | 2 +-
 extensions/pknock/Makefile.am  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
extensions/ACCOUNT/Makefile.am +1 -1
index 65a956697b20..473a739f981a 100644
@@ -3,7 +3,7 @@
 AM_CPPFLAGS = ${regular_CPPFLAGS} -I${abs_top_srcdir}/extensions
 AM_CFLAGS   = ${regular_CFLAGS} ${libxtables_CFLAGS}
 
-include ../../Makefile.extra
+include $(top_srcdir)/Makefile.extra
 
 sbin_PROGRAMS = iptaccount
 iptaccount_LDADD = libxt_ACCOUNT_cl.la
extensions/Makefile.am +1 -1
index a487fd8c141a..eebb82fd2f22 100644
@@ -26,4 +26,4 @@ install-exec-local: modules_install
 
 clean-local: clean_modules
 
-include ../Makefile.extra
+include $(top_srcdir)/Makefile.extra
extensions/pknock/Makefile.am +1 -1
index 35528709aa15..5fcae4794230 100644
@@ -3,7 +3,7 @@
 AM_CPPFLAGS = ${regular_CPPFLAGS} -I${abs_top_srcdir}/extensions
 AM_CFLAGS   = ${regular_CFLAGS} ${libxtables_CFLAGS}
 
-include ../../Makefile.extra
+include $(top_srcdir)/Makefile.extra
 
 sbin_PROGRAMS = pknlusr
 dist_man_MANS = pknlusr.8
Signature · 1 line
2.40.1
#2 lore raw

PATCH 2/5 build: replace `AM_V_silent` with `AM_V_at`

In reply to Jeremy Sowden

AM_V_silent was buggy and defined in the wrong place. Replace it with AM_V_at, which is provided by automake for the same purpose.

---
 Makefile.iptrules.in   | 3 ---
 extensions/Makefile.am | 6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)
Makefile.iptrules.in +0 -3
index fcac8856283d..f2f202ada360 100644
@@ -21,15 +21,12 @@ AM_DEFAULT_VERBOSITY = 0
 am__v_CC_0           = @echo "  CC    " $@;
 am__v_CCLD_0         = @echo "  CCLD  " $@;
 am__v_GEN_0          = @echo "  GEN   " $@;
-am__v_SILENT_0       = @
 am__v_CC_            = ${am__v_CC_${AM_DEFAULT_VERBOSITY}}
 am__v_CCLD_          = ${am__v_CCLD_${AM_DEFAULT_VERBOSITY}}
 am__v_GEN_           = ${am__v_GEN_${AM_DEFAULT_VERBOSITY}}
-am__v_SILENT_        = ${am__v_SILENT_${AM_DEFAULT_VERBOSITY}}
 AM_V_CC              = ${am__v_CC_${V}}
 AM_V_CCLD            = ${am__v_CCLD_${V}}
 AM_V_GEN             = ${am__v_GEN_${V}}
-AM_V_silent          = ${am__v_GEN_${V}}
 
 include ${XA_TOPSRCDIR}/mconfig
 -include ${XA_TOPSRCDIR}/mconfig.*
extensions/Makefile.am +3 -3
index eebb82fd2f22..b99712dfcd38 100644
@@ -12,13 +12,13 @@ _kcall = -C ${kbuilddir} M=${abs_srcdir}
 modules:
 	@echo -n "Xtables-addons ${PACKAGE_VERSION} - Linux "
 	@if [ -n "${kbuilddir}" ]; then ${MAKE} ${_kcall} --no-print-directory -s kernelrelease; fi;
-	${AM_V_silent}if [ -n "${kbuilddir}" ]; then ${MAKE} ${_kcall} modules; fi;
+	${AM_V_at}if [ -n "${kbuilddir}" ]; then ${MAKE} ${_kcall} modules; fi;
 
 modules_install:
-	${AM_V_silent}if [ -n "${kbuilddir}" ]; then ${MAKE} ${_kcall} INSTALL_MOD_PATH=${DESTDIR} ext-mod-dir='$${INSTALL_MOD_DIR}' modules_install; fi;
+	${AM_V_at}if [ -n "${kbuilddir}" ]; then ${MAKE} ${_kcall} INSTALL_MOD_PATH=${DESTDIR} ext-mod-dir='$${INSTALL_MOD_DIR}' modules_install; fi;
 
 clean_modules:
-	${AM_V_silent}if [ -n "${kbuilddir}" ]; then ${MAKE} ${_kcall} clean; fi;
+	${AM_V_at}if [ -n "${kbuilddir}" ]; then ${MAKE} ${_kcall} clean; fi;
 
 all-local: modules
 
Signature · 1 line
2.40.1
#3 lore raw

PATCH 3/5 build: update `AM_V_*` definitions to match autotools

In reply to Jeremy Sowden

Follow the automake documentation and use autoconf substitution variables.

Add a couple of extra trailing spaces to match the definitions generated by automake.

---
 Makefile.iptrules.in | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
Makefile.iptrules.in +9 -9
index f2f202ada360..28feeb477e35 100644
@@ -18,15 +18,15 @@ libxtables_LIBS   = @libxtables_LIBS@
 AM_DEPFLAGS     = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
 
 AM_DEFAULT_VERBOSITY = 0
-am__v_CC_0           = @echo "  CC    " $@;
-am__v_CCLD_0         = @echo "  CCLD  " $@;
-am__v_GEN_0          = @echo "  GEN   " $@;
-am__v_CC_            = ${am__v_CC_${AM_DEFAULT_VERBOSITY}}
-am__v_CCLD_          = ${am__v_CCLD_${AM_DEFAULT_VERBOSITY}}
-am__v_GEN_           = ${am__v_GEN_${AM_DEFAULT_VERBOSITY}}
-AM_V_CC              = ${am__v_CC_${V}}
-AM_V_CCLD            = ${am__v_CCLD_${V}}
-AM_V_GEN             = ${am__v_GEN_${V}}
+am__v_CC_0           = @echo "  CC      " $@;
+am__v_CCLD_0         = @echo "  CCLD    " $@;
+am__v_GEN_0          = @echo "  GEN     " $@;
+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_CC              = ${am__v_CC_@AM_V@}
+AM_V_CCLD            = ${am__v_CCLD_@AM_V@}
+AM_V_GEN             = ${am__v_GEN_@AM_V@}
 
 include ${XA_TOPSRCDIR}/mconfig
 -include ${XA_TOPSRCDIR}/mconfig.*
Signature · 1 line
2.40.1
#4 lore raw

Re: [PATCH xtables-addons 3/5] build: update `AM_V_*` definitions to match autotools

Quoted 3 lines · Jeremy Sowden

Follow the automake documentation and use autoconf substitution variables.

Add a couple of extra trailing spaces to match the definitions generated by automake.

Ha! xt-a had a 6-wide label because that's what automake did at the time. Seems that changed in automake.git#94121099cfe42ca944eaff6805a5404ee0234060 .

#5 lore raw

PATCH 4/5 build: don't hard-code `AM_DEFAULT_VERBOSITY` in Makefile.iptrules

In reply to Jeremy Sowden

Currently it is set to zero, which means that the default in Makefile.iptrules is not consistent with that in the other Makefiles, and passing --disable-silent-rules to configure cannot be used to change it.

Set it to @AM_DEFAULT_VERBOSITY@ instead, which will be expanded to the appropriate default value.

---
 Makefile.iptrules.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile.iptrules.in +2 -2
index 28feeb477e35..b0588d45f026 100644
@@ -15,9 +15,9 @@ LDFLAGS         = @LDFLAGS@
 
 libxtables_CFLAGS = @libxtables_CFLAGS@
 libxtables_LIBS   = @libxtables_LIBS@
-AM_DEPFLAGS     = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
+AM_DEPFLAGS       = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
 
-AM_DEFAULT_VERBOSITY = 0
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 am__v_CC_0           = @echo "  CC      " $@;
 am__v_CCLD_0         = @echo "  CCLD    " $@;
 am__v_GEN_0          = @echo "  GEN     " $@;
Signature · 1 line
2.40.1
#6 lore raw

PATCH 5/5 build: define `AM_V_GEN` where it is needed

In reply to Jeremy Sowden

AM_V_GEN is used when generating the man-pages. Defining it in Makefile.iptrules is of no use. Move the definition to the appropriate Makefile.

---
 Makefile.iptrules.in | 3 ---
 Makefile.mans.in     | 5 +++++
 2 files changed, 5 insertions(+), 3 deletions(-)
Makefile.iptrules.in +0 -3
index b0588d45f026..7e5816451736 100644
@@ -20,13 +20,10 @@ AM_DEPFLAGS       = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
 am__v_CC_0           = @echo "  CC      " $@;
 am__v_CCLD_0         = @echo "  CCLD    " $@;
-am__v_GEN_0          = @echo "  GEN     " $@;
 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_CC              = ${am__v_CC_@AM_V@}
 AM_V_CCLD            = ${am__v_CCLD_@AM_V@}
-AM_V_GEN             = ${am__v_GEN_@AM_V@}
 
 include ${XA_TOPSRCDIR}/mconfig
 -include ${XA_TOPSRCDIR}/mconfig.*
Makefile.mans.in +5 -0
index 63424f7d558a..60459cb98c83 100644
@@ -8,6 +8,11 @@ wcman_targets := $(shell find "${srcdir}/extensions" -name 'libxt_[A-Z]*.man' -p
 wlist_matches := $(patsubst ${srcdir}/libxt_%.man,%,${wcman_matches})
 wlist_targets := $(patsubst ${srcdir}/libxt_%.man,%,${wcman_targets})
 
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+am__v_GEN_0          = @echo "  GEN     " $@;
+am__v_GEN_           = ${am__v_GEN_@AM_DEFAULT_V@}
+AM_V_GEN             = ${am__v_GEN_@AM_V@}
+
 .PHONY: FORCE
 
 FORCE:
Signature · 1 line
2.40.1