netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] build: avoid unnecessary rebuild of iptables when rerunning configure
@ 2019-05-31  6:49 Jan Engelhardt
  2019-05-31 16:02 ` Florian Westphal
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Engelhardt @ 2019-05-31  6:49 UTC (permalink / raw)
  To: fw; +Cc: netfilter-devel

Running configure always touches xtables/xtables-version.h, which
causes parts to rebuild even when the configuration has not changed.
(`./configure; make; ./configure; make;`).

This can be avoided if the AC_CONFIG_FILES mechanism is replaced by
one that does a compare and leaves an existing xtables-version.h
unmodified if the sed result stays the same when it re-runs.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
 Makefile.am  | 8 ++++++--
 configure.ac | 1 -
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 799bf8b8..2e29bb5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,5 +29,9 @@ tarball:
 	tar -C /tmp -cjf ${PACKAGE_TARNAME}-${PACKAGE_VERSION}.tar.bz2 --owner=root --group=root ${PACKAGE_TARNAME}-${PACKAGE_VERSION}/;
 	rm -Rf /tmp/${PACKAGE_TARNAME}-${PACKAGE_VERSION};
 
-config.status: extensions/GNUmakefile.in \
-	include/xtables-version.h.in
+config.status: extensions/GNUmakefile.in
+
+include/xtables-version.h: include/xtables-version.h.in
+	${AM_V_GEN} sed -e 's|@@libxtables_vmajor@@|${libxtables_vmajor}|g' <$< >include/.xtables-version.tmp; \
+	cmp include/xtables-version.h include/.xtables-version.tmp || \
+		mv include/.xtables-version.tmp include/xtables-version.h
diff --git a/configure.ac b/configure.ac
index c922f7a0..2767c911 100644
--- a/configure.ac
+++ b/configure.ac
@@ -245,7 +245,6 @@ AC_CONFIG_FILES([Makefile extensions/GNUmakefile include/Makefile
 	libiptc/Makefile libiptc/libiptc.pc
 	libiptc/libip4tc.pc libiptc/libip6tc.pc
 	libxtables/Makefile utils/Makefile
-	include/xtables-version.h
 	iptables/xtables-monitor.8
 	utils/nfnl_osf.8
 	utils/nfbpf_compile.8])
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] build: avoid unnecessary rebuild of iptables when rerunning configure
  2019-05-31  6:49 [PATCH] build: avoid unnecessary rebuild of iptables when rerunning configure Jan Engelhardt
@ 2019-05-31 16:02 ` Florian Westphal
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2019-05-31 16:02 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: fw, netfilter-devel

Jan Engelhardt <jengelh@inai.de> wrote:
> Running configure always touches xtables/xtables-version.h, which
> causes parts to rebuild even when the configuration has not changed.
> (`./configure; make; ./configure; make;`).
> 
> This can be avoided if the AC_CONFIG_FILES mechanism is replaced by
> one that does a compare and leaves an existing xtables-version.h
> unmodified if the sed result stays the same when it re-runs.

bash autogen.sh
./configure
make

build ends with:
Making all in include
make[2]: Entering directory
'/home/fw/git/netfilter.org/iptables/include'
make[2]: *** No rule to make target 'xtables-version.h', needed by 'all-am'.  Stop.
make[2]: Leaving directory '/home/fw/git/netfilter.org/iptables/include'
make[1]: *** [Makefile:501: all-recursive] Error 1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-31 16:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31  6:49 [PATCH] build: avoid unnecessary rebuild of iptables when rerunning configure Jan Engelhardt
2019-05-31 16:02 ` Florian Westphal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).