[PATCH] build: avoid unnecessary rebuild of iptables when rerunning configure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 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




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux