f54481c05b958a83606f9e1594f1ceb91e2e8030
[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.3
7 PKG_RELEASE:=2
8 PKG_MD5SUM:=86d88455520cfdc56fd7ae27897a80a4
9
10 PKG_SOURCE_URL:=http://www.netfilter.org/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 -fpR $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m}.so $$(IDIR_$(1))/usr/lib/iptables/ ; \
26 done
27 $(RSTRIP) $$(IDIR_$(1))
28 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
29
30 endef
31
32 include $(TOPDIR)/package/rules.mk
33 include $(LINUX_DIR)/.config
34 include $(TOPDIR)/target/linux/netfilter.mk
35
36 $(eval $(call PKG_template,IPTABLES,iptables,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
37 $(eval $(call PKG_template,IPTABLES_EXTRA,iptables-extra,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
38 $(eval $(call PKG_template,IPTABLES_UTILS,iptables-utils,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
39 $(eval $(call PKG_template,IP6TABLES,ip6tables,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
40
41 $(eval $(call PKG_template,IPTABLES_MOD_CONNTRACK,iptables-mod-conntrack,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
42 $(eval $(call PKG_template,IPTABLES_MOD_EXTRA,iptables-mod-extra,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
43 $(eval $(call PKG_template,IPTABLES_MOD_FILTER,iptables-mod-filter,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
44 $(eval $(call PKG_template,IPTABLES_MOD_IMQ,iptables-mod-img,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
45 $(eval $(call PKG_template,IPTABLES_MOD_IPOPT,iptables-mod-ipopt,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
46 $(eval $(call PKG_template,IPTABLES_MOD_IPSEC,iptables-mod-ipsec,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
47 $(eval $(call PKG_template,IPTABLES_MOD_NAT,iptables-mod-nat,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
48 $(eval $(call PKG_template,IPTABLES_MOD_ULOG,iptables-mod-ulog,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
49
50 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_CONNTRACK,$(IPKG_IPTABLES_MOD_CONNTRACK-m)))
51 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_EXTRA,$(IPKG_IPTABLES_MOD_EXTRA-m)))
52 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_FILTER,$(IPKG_IPTABLES_MOD_FILTER-m)))
53 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_IMQ,$(IPKG_IPTABLES_MOD_IMQ-m)))
54 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_IPOPT,$(IPKG_IPTABLES_MOD_IPOPT-m)))
55 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_IPSEC,$(IPKG_IPTABLES_MOD_IPSEC-m)))
56 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_NAT,$(IPKG_IPTABLES_MOD_NAT-m)))
57 $(eval $(call IPKG_plugin_template,IPTABLES_MOD_ULOG,$(IPKG_IPTABLES_MOD_ULOG-m)))
58
59 $(PKG_BUILD_DIR)/.configured:
60 touch $@
61
62 $(PKG_BUILD_DIR)/.built:
63 chmod a+x $(PKG_BUILD_DIR)/extensions/.*-test*
64 mkdir -p $(PKG_INSTALL_DIR)
65 $(MAKE) -C $(PKG_BUILD_DIR) \
66 $(TARGET_CONFIGURE_OPTS) \
67 CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \
68 KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
69 DESTDIR="$(PKG_INSTALL_DIR)" \
70 all install install-devel
71 touch $@
72
73 $(IPKG_IPTABLES):
74 install -d -m0755 $(IDIR_IPTABLES)/usr/sbin
75 cp -fpR $(PKG_INSTALL_DIR)/usr/sbin/iptables $(IDIR_IPTABLES)/usr/sbin/
76 install -d -m0755 $(IDIR_IPTABLES)/usr/lib/iptables
77 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
78 cp -fpR $(patsubst %,lib%.so,$(IPKG_IPTABLES-y) ipt_standard) $(IDIR_IPTABLES)/usr/lib/iptables/ \
79 )
80 $(RSTRIP) $(IDIR_IPTABLES)
81 $(IPKG_BUILD) $(IDIR_IPTABLES) $(PACKAGE_DIR)
82
83 $(IPKG_IPTABLES_UTILS):
84 install -d -m0755 $(IDIR_IPTABLES_UTILS)/usr/sbin
85 cp -fpR $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(IDIR_IPTABLES_UTILS)/usr/sbin/
86 $(RSTRIP) $(IDIR_IPTABLES_UTILS)
87 $(IPKG_BUILD) $(IDIR_IPTABLES_UTILS) $(PACKAGE_DIR)
88
89 $(IPKG_IP6TABLES):
90 install -d -m0755 $(IDIR_IP6TABLES)/usr/sbin
91 cp -fpR $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(IDIR_IP6TABLES)/usr/sbin/
92 install -d -m0755 $(IDIR_IP6TABLES)/usr/lib/iptables
93 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
94 cp -fpR libip6t_*.so $(IDIR_IP6TABLES)/usr/lib/iptables/ \
95 )
96 $(RSTRIP) $(IDIR_IP6TABLES)
97 $(IPKG_BUILD) $(IDIR_IP6TABLES) $(PACKAGE_DIR)
98
99 $(STAGING_DIR)/usr/lib/libipq.a: $(PKG_BUILD_DIR)/.built
100 mkdir -p $(STAGING_DIR)/usr/include
101 cp -fpR $(PKG_INSTALL_DIR)/usr/include/libipq.h $(STAGING_DIR)/usr/include/
102 mkdir -p $(STAGING_DIR)/usr/lib
103 cp -fpR $(PKG_INSTALL_DIR)/usr/lib/libipq.a $(STAGING_DIR)/usr/lib/
104
105 install-dev: $(STAGING_DIR)/usr/lib/libipq.a
106
107 uninstall-dev:
108 rm -rf $(STAGING_DIR)/usr/include/libipq.h
109 rm -rf $(STAGING_DIR)/usr/lib/libipq.a
110
111 compile-targets: install-dev
112 clean-targets: uninstall-dev