upgrade to iptables 1.3.5
[openwrt/svn-archive/archive.git] / openwrt / package / iptables / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=iptables
6 PKG_VERSION:=1.3.5
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=00fb916fa8040ca992a5ace56d905ea5
9
10 PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \
11 ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \
12 ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \
13 ftp://ftp.no.netfilter.org/pub/netfilter/iptables/
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_CAT:=bzcat
16
17 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
18 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
19
20 define IPKG_plugin_template
21
22 $$(IPKG_$(1)):
23 install -m0755 -d $$(IDIR_$(1))/usr/lib/iptables
24 for m in $(2); do \
25 $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so $$(IDIR_$(1))/usr/lib/iptables/ ; \
26 done
27 @[ -z "$(3)" ] || $(MAKE) $(3)
28 $(RSTRIP) $$(IDIR_$(1))
29 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
30
31 endef
32
33 include $(TOPDIR)/package/rules.mk
34 include $(LINUX_DIR)/.config
35 include $(TOPDIR)/target/linux/netfilter.mk
36
37 $(eval $(call PKG_template,IPTABLES,iptables,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
38 $(eval $(call PKG_template,IPTABLES_EXTRA,iptables-extra,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
39 $(eval $(call PKG_template,IPTABLES_UTILS,iptables-utils,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
40 $(eval $(call PKG_template,IP6TABLES,ip6tables,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
41
42 $(eval $(call PKG_template,IPTABLES_MOD_CONNTRACK,iptables-mod-conntrack,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
43 $(eval $(call PKG_template,IPTABLES_MOD_EXTRA,iptables-mod-extra,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
44 $(eval $(call PKG_template,IPTABLES_MOD_FILTER,iptables-mod-filter,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
45 $(eval $(call PKG_template,IPTABLES_MOD_IMQ,iptables-mod-imq,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
46 $(eval $(call PKG_template,IPTABLES_MOD_IPOPT,iptables-mod-ipopt,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
47 $(eval $(call PKG_template,IPTABLES_MOD_IPSEC,iptables-mod-ipsec,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
48 $(eval $(call PKG_template,IPTABLES_MOD_NAT,iptables-mod-nat,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
49 $(eval $(call PKG_template,IPTABLES_MOD_ULOG,iptables-mod-ulog,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
50
51 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_CONNTRACK,$(IPT_CONNTRACK-m)))
52 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_EXTRA,$(IPT_EXTRA-m)))
53 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_FILTER,$(IPT_FILTER-m),layer7-install))
54 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_IMQ,$(IPT_IMQ-m)))
55 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_IPOPT,$(IPT_IPOPT-m)))
56 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_IPSEC,$(IPT_IPSEC-m)))
57 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_NAT,$(IPT_NAT-m)))
58 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_ULOG,$(IPT_ULOG-m)))
59
60 $(PKG_BUILD_DIR)/.configured:
61 touch $@
62
63 $(PKG_BUILD_DIR)/.built:
64 chmod a+x $(PKG_BUILD_DIR)/extensions/.*-test*
65 mkdir -p $(PKG_INSTALL_DIR)
66 $(MAKE) -C $(PKG_BUILD_DIR) \
67 $(TARGET_CONFIGURE_OPTS) \
68 CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \
69 KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
70 DESTDIR="$(PKG_INSTALL_DIR)" \
71 all install install-devel
72 touch $@
73
74 $(IPKG_IPTABLES):
75 install -d -m0755 $(IDIR_IPTABLES)/usr/sbin
76 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(IDIR_IPTABLES)/usr/sbin/
77 install -d -m0755 $(IDIR_IPTABLES)/usr/lib/iptables
78 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
79 $(CP) $(patsubst %,lib%.so,$(IPT_BUILTIN)) $(IDIR_IPTABLES)/usr/lib/iptables/ \
80 )
81 $(RSTRIP) $(IDIR_IPTABLES)
82 $(IPKG_BUILD) $(IDIR_IPTABLES) $(PACKAGE_DIR)
83
84 $(IPKG_IPTABLES_EXTRA):
85 $(IPKG_BUILD) $(IDIR_IPTABLES_EXTRA) $(PACKAGE_DIR)
86
87 $(IPKG_IPTABLES_UTILS):
88 install -d -m0755 $(IDIR_IPTABLES_UTILS)/usr/sbin
89 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(IDIR_IPTABLES_UTILS)/usr/sbin/
90 $(RSTRIP) $(IDIR_IPTABLES_UTILS)
91 $(IPKG_BUILD) $(IDIR_IPTABLES_UTILS) $(PACKAGE_DIR)
92
93 $(IPKG_IP6TABLES):
94 install -d -m0755 $(IDIR_IP6TABLES)/usr/sbin
95 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(IDIR_IP6TABLES)/usr/sbin/
96 install -d -m0755 $(IDIR_IP6TABLES)/usr/lib/iptables
97 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
98 $(CP) libip6t_*.so $(IDIR_IP6TABLES)/usr/lib/iptables/ \
99 )
100 $(RSTRIP) $(IDIR_IP6TABLES)
101 $(IPKG_BUILD) $(IDIR_IP6TABLES) $(PACKAGE_DIR)
102
103 $(STAGING_DIR)/usr/lib/libipq.a: $(PKG_BUILD_DIR)/.built
104 mkdir -p $(STAGING_DIR)/usr/include
105 $(CP) $(PKG_INSTALL_DIR)/usr/include/libipq.h $(STAGING_DIR)/usr/include/
106 mkdir -p $(STAGING_DIR)/usr/lib
107 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.a $(STAGING_DIR)/usr/lib/
108
109 layer7-install:
110 mkdir -p $(IDIR_IPTABLES_MOD_FILTER)/etc/l7-protocols
111 $(CP) files/l7/*.pat $(IDIR_IPTABLES_MOD_FILTER)/etc/l7-protocols/
112
113 install-dev: $(STAGING_DIR)/usr/lib/libipq.a
114
115 uninstall-dev:
116 rm -rf $(STAGING_DIR)/usr/include/libipq.h
117 rm -rf $(STAGING_DIR)/usr/lib/libipq.a
118
119 compile-targets: install-dev
120 clean-targets: uninstall-dev