]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables/Makefile: Reorg variable assignments
authorPhil Sutter <phil@nwl.cc>
Mon, 5 Dec 2022 16:29:30 +0000 (17:29 +0100)
committerPhil Sutter <phil@nwl.cc>
Wed, 14 Dec 2022 14:47:14 +0000 (15:47 +0100)
Introduce helper variables holding SOURCES, LDADD and CFLAGS used by
both legacy and nft builds. Specify also internal header files, builds
should depend on them. Doing that, reorder lists for clarity.

Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/Makefile.am

index 8c346698655c4311d001e3e7bc8af4ee892095ee..77202ad80934fc3a3eea54d4d6252d02a951582b 100644 (file)
@@ -6,46 +6,52 @@ AM_LDFLAGS       = ${regular_LDFLAGS}
 
 BUILT_SOURCES =
 
-xtables_legacy_multi_SOURCES  = xtables-legacy-multi.c iptables-xml.c
-xtables_legacy_multi_CFLAGS   = ${AM_CFLAGS}
-xtables_legacy_multi_LDADD    = ../extensions/libext.a
+common_sources = iptables-xml.c xtables-multi.h xshared.c xshared.h
+common_ldadd   = ../extensions/libext.a ../libxtables/libxtables.la -lm
+common_cflags  = ${AM_CFLAGS}
 if ENABLE_STATIC
-xtables_legacy_multi_CFLAGS  += -DALL_INCLUSIVE
+common_cflags += -DALL_INCLUSIVE
 endif
+
+xtables_legacy_multi_SOURCES  = ${common_sources} xtables-legacy-multi.c \
+                               iptables-restore.c iptables-save.c
+xtables_legacy_multi_CFLAGS   = ${common_cflags}
+xtables_legacy_multi_LDADD    = ${common_ldadd}
 if ENABLE_IPV4
-xtables_legacy_multi_SOURCES += iptables-standalone.c iptables.c
+xtables_legacy_multi_SOURCES += iptables-standalone.c iptables.c iptables-multi.h
 xtables_legacy_multi_CFLAGS  += -DENABLE_IPV4
 xtables_legacy_multi_LDADD   += ../libiptc/libip4tc.la ../extensions/libext4.a
 endif
 if ENABLE_IPV6
-xtables_legacy_multi_SOURCES += ip6tables-standalone.c ip6tables.c
+xtables_legacy_multi_SOURCES += ip6tables-standalone.c ip6tables.c ip6tables-multi.h
 xtables_legacy_multi_CFLAGS  += -DENABLE_IPV6
 xtables_legacy_multi_LDADD   += ../libiptc/libip6tc.la ../extensions/libext6.a
 endif
-xtables_legacy_multi_SOURCES += xshared.c iptables-restore.c iptables-save.c
-xtables_legacy_multi_LDADD   += ../libxtables/libxtables.la -lm
 
 # iptables using nf_tables api
 if ENABLE_NFTABLES
-xtables_nft_multi_SOURCES  = xtables-nft-multi.c iptables-xml.c
-xtables_nft_multi_CFLAGS   = ${AM_CFLAGS}
-xtables_nft_multi_LDADD    = ../extensions/libext.a ../extensions/libext_ebt.a
-if ENABLE_STATIC
-xtables_nft_multi_CFLAGS  += -DALL_INCLUSIVE
-endif
+xtables_nft_multi_SOURCES  = ${common_sources} xtables-nft-multi.c
+xtables_nft_multi_CFLAGS   = ${common_cflags}
+xtables_nft_multi_LDADD    = ${common_ldadd} \
+                            ../extensions/libext_arpt.a \
+                            ../extensions/libext_ebt.a \
+                            ../extensions/libext4.a \
+                            ../extensions/libext6.a \
+                            ${libmnl_LIBS} ${libnftnl_LIBS} \
+                            ${libnetfilter_conntrack_LIBS}
 xtables_nft_multi_CFLAGS  += -DENABLE_NFTABLES -DENABLE_IPV4 -DENABLE_IPV6
-xtables_nft_multi_SOURCES += xtables-save.c xtables-restore.c \
-                               xtables-standalone.c xtables.c nft.c \
-                               nft-shared.c nft-ipv4.c nft-ipv6.c nft-arp.c \
-                               xtables-monitor.c nft-cache.c \
-                               xtables-arp.c \
-                               nft-bridge.c nft-cmd.c nft-chain.c \
-                               xtables-eb-standalone.c xtables-eb.c \
-                               xtables-eb-translate.c \
-                               xtables-translate.c
-xtables_nft_multi_LDADD   += ${libmnl_LIBS} ${libnftnl_LIBS} ${libnetfilter_conntrack_LIBS} ../extensions/libext4.a ../extensions/libext6.a ../extensions/libext_ebt.a ../extensions/libext_arpt.a
-xtables_nft_multi_SOURCES += xshared.c
-xtables_nft_multi_LDADD   += ../libxtables/libxtables.la -lm
+xtables_nft_multi_SOURCES += nft.c nft.h \
+                            nft-arp.c nft-ipv4.c nft-ipv6.c \
+                            nft-bridge.c nft-bridge.h \
+                            nft-cache.c nft-cache.h \
+                            nft-chain.c nft-chain.h \
+                            nft-cmd.c nft-cmd.h \
+                            nft-shared.c nft-shared.h \
+                            xtables-monitor.c \
+                            xtables.c xtables-arp.c xtables-eb.c \
+                            xtables-standalone.c xtables-eb-standalone.c \
+                            xtables-translate.c xtables-eb-translate.c \
+                            xtables-save.c xtables-restore.c
 endif
 
 sbin_PROGRAMS    = xtables-legacy-multi