1# -*- Makefile -*- 2 3AM_CFLAGS = ${regular_CFLAGS} 4AM_CPPFLAGS = ${regular_CPPFLAGS} \ 5 -I${top_builddir}/include \ 6 -I${top_srcdir}/include \ 7 -I${top_srcdir} \ 8 ${kinclude_CPPFLAGS} \ 9 ${libmnl_CFLAGS} \ 10 ${libnftnl_CFLAGS} \ 11 ${libnetfilter_conntrack_CFLAGS} 12AM_LDFLAGS = ${regular_LDFLAGS} 13 14BUILT_SOURCES = 15 16common_sources = iptables-xml.c xtables-multi.h xshared.c xshared.h 17common_ldadd = ../extensions/libext.a ../libxtables/libxtables.la -lm 18common_cflags = ${AM_CFLAGS} 19if ENABLE_STATIC 20common_cflags += -DALL_INCLUSIVE 21endif 22 23xtables_legacy_multi_SOURCES = ${common_sources} xtables-legacy-multi.c \ 24 iptables-restore.c iptables-save.c 25xtables_legacy_multi_CFLAGS = ${common_cflags} 26xtables_legacy_multi_LDADD = ${common_ldadd} 27if ENABLE_IPV4 28xtables_legacy_multi_SOURCES += iptables-standalone.c iptables.c iptables-multi.h 29xtables_legacy_multi_CFLAGS += -DENABLE_IPV4 30xtables_legacy_multi_LDADD += ../libiptc/libip4tc.la ../extensions/libext4.a 31endif 32if ENABLE_IPV6 33xtables_legacy_multi_SOURCES += ip6tables-standalone.c ip6tables.c ip6tables-multi.h 34xtables_legacy_multi_CFLAGS += -DENABLE_IPV6 35xtables_legacy_multi_LDADD += ../libiptc/libip6tc.la ../extensions/libext6.a 36endif 37 38# iptables using nf_tables api 39if ENABLE_NFTABLES 40xtables_nft_multi_SOURCES = ${common_sources} xtables-nft-multi.c 41xtables_nft_multi_CFLAGS = ${common_cflags} 42xtables_nft_multi_LDADD = ${common_ldadd} \ 43 ../extensions/libext_arpt.a \ 44 ../extensions/libext_ebt.a \ 45 ../extensions/libext4.a \ 46 ../extensions/libext6.a \ 47 ${libmnl_LIBS} ${libnftnl_LIBS} \ 48 ${libnetfilter_conntrack_LIBS} 49xtables_nft_multi_CFLAGS += -DENABLE_NFTABLES -DENABLE_IPV4 -DENABLE_IPV6 50xtables_nft_multi_SOURCES += nft.c nft.h \ 51 nft-arp.c nft-ipv4.c nft-ipv6.c \ 52 nft-bridge.c nft-bridge.h \ 53 nft-cache.c nft-cache.h \ 54 nft-chain.c nft-chain.h \ 55 nft-cmd.c nft-cmd.h \ 56 nft-ruleparse.c nft-ruleparse.h \ 57 nft-ruleparse-arp.c nft-ruleparse-bridge.c \ 58 nft-ruleparse-ipv4.c nft-ruleparse-ipv6.c \ 59 nft-shared.c nft-shared.h \ 60 xtables-monitor.c \ 61 xtables.c xtables-arp.c xtables-eb.c \ 62 xtables-standalone.c xtables-eb-standalone.c \ 63 xtables-translate.c xtables-eb-translate.c \ 64 xtables-save.c xtables-restore.c 65endif 66 67sbin_PROGRAMS = xtables-legacy-multi 68if ENABLE_NFTABLES 69sbin_PROGRAMS += xtables-nft-multi 70endif 71man_MANS = iptables.8 iptables-restore.8 iptables-save.8 \ 72 iptables-xml.1 ip6tables.8 ip6tables-restore.8 \ 73 ip6tables-save.8 iptables-extensions.8 \ 74 iptables-apply.8 ip6tables-apply.8 75 76dist_sbin_SCRIPTS = iptables-apply 77dist_pkgdata_DATA = iptables.xslt 78 79xlate_man_links = iptables-translate.8 ip6tables-translate.8 \ 80 iptables-restore-translate.8 ip6tables-restore-translate.8 \ 81 ebtables-translate.8 arptables-translate.8 82 83if ENABLE_NFTABLES 84man_MANS += ${xlate_man_links} xtables-monitor.8 85 86dist_man_MANS = xtables-nft.8 xtables-translate.8 xtables-legacy.8 \ 87 arptables-nft.8 arptables-nft-restore.8 arptables-nft-save.8 \ 88 ebtables-nft.8 89endif 90CLEANFILES = ${man_MANS} iptables-extensions.8.tmpl 91 92vx_bin_links = iptables-xml 93if ENABLE_IPV4 94v4_sbin_links = iptables-legacy iptables-legacy-restore iptables-legacy-save \ 95 iptables iptables-restore iptables-save 96endif 97if ENABLE_IPV6 98v6_sbin_links = ip6tables-legacy ip6tables-legacy-restore ip6tables-legacy-save \ 99 ip6tables ip6tables-restore ip6tables-save 100endif 101if ENABLE_NFTABLES 102x_sbin_links = iptables-nft iptables-nft-restore iptables-nft-save \ 103 ip6tables-nft ip6tables-nft-restore ip6tables-nft-save \ 104 iptables-translate ip6tables-translate ebtables-translate \ 105 iptables-restore-translate ip6tables-restore-translate \ 106 arptables-nft arptables \ 107 arptables-nft-restore arptables-restore \ 108 arptables-nft-save arptables-save \ 109 arptables-translate \ 110 ebtables-nft ebtables \ 111 ebtables-nft-restore ebtables-restore \ 112 ebtables-nft-save ebtables-save \ 113 xtables-monitor 114endif 115 116iptables-extensions.8: iptables-extensions.8.tmpl ../extensions/matches.man ../extensions/targets.man 117 ${AM_V_GEN} sed \ 118 -e '/@MATCH@/ r ../extensions/matches.man' \ 119 -e '/@TARGET@/ r ../extensions/targets.man' $< >$@; 120 121${xlate_man_links}: 122 ${AM_V_GEN} echo '.so man8/xtables-translate.8' >$@ 123 124ip6tables.8 ip6tables-apply.8 ip6tables-restore.8 ip6tables-save.8: 125 ${AM_V_GEN} echo "$@" | sed 's|^ip6|.so man8/ip|' >$@ 126 127pkgconfig_DATA = xtables.pc 128 129# Using if..fi avoids an ugly "error (ignored)" message :) 130install-exec-hook: 131 -if test -z "${DESTDIR}"; then /sbin/ldconfig; fi; 132 ${INSTALL} -dm0755 "${DESTDIR}${bindir}"; 133 for i in ${vx_bin_links}; do ${LN_S} -f "${sbindir}/xtables-legacy-multi" "${DESTDIR}${bindir}/$$i"; done; 134 for i in ${v4_sbin_links}; do ${LN_S} -f xtables-legacy-multi "${DESTDIR}${sbindir}/$$i"; done; 135 for i in ${v6_sbin_links}; do ${LN_S} -f xtables-legacy-multi "${DESTDIR}${sbindir}/$$i"; done; 136 for i in ${x_sbin_links}; do ${LN_S} -f xtables-nft-multi "${DESTDIR}${sbindir}/$$i"; done; 137 ${LN_S} -f iptables-apply "${DESTDIR}${sbindir}/ip6tables-apply" 138 139uninstall-hook: 140 dir=${DESTDIR}${bindir}; { \ 141 test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; \ 142 } || { \ 143 test -z "${vx_bin_links}" || ( \ 144 cd "$$dir" && rm -f ${vx_bin_links} \ 145 ) \ 146 } 147 dir=${DESTDIR}${sbindir}; { \ 148 test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; \ 149 } || { \ 150 test -z "${v4_sbin_links}" || ( \ 151 cd "$$dir" && rm -f ${v4_sbin_links} \ 152 ); \ 153 test -z "${v6_sbin_links}" || ( \ 154 cd "$$dir" && rm -f ${v6_sbin_links} \ 155 ); \ 156 test -z "${x_sbin_links}" || ( \ 157 cd "$$dir" && rm -f ${x_sbin_links} \ 158 ); \ 159 ( cd "$$dir" && rm -f ip6tables-apply ); \ 160 } 161 162EXTRA_DIST = tests 163