fix segfault in locking utility
[openwrt.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 $$(patsubst xt_%,ipt_%,$(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)/etc/config
76 install -m0644 ./files/firewall.config $(IDIR_IPTABLES)/etc/config/firewall
77 install -d -m0755 $(IDIR_IPTABLES)/etc/init.d
78 install -m0755 ./files/firewall.init $(IDIR_IPTABLES)/etc/init.d/S45firewall
79 install -m0755 ./files/firewall.user $(IDIR_IPTABLES)/etc/
80 install -d -m0755 $(IDIR_IPTABLES)/usr/lib
81 install -m0644 ./files/firewall.awk $(IDIR_IPTABLES)/usr/lib
82 install -d -m0755 $(IDIR_IPTABLES)/usr/sbin
83 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(IDIR_IPTABLES)/usr/sbin/
84 install -d -m0755 $(IDIR_IPTABLES)/usr/lib/iptables
85 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
86 $(CP) $(patsubst %,lib%.so,$(IPT_BUILTIN:xt_%=ipt_%)) $(IDIR_IPTABLES)/usr/lib/iptables/ \
87 )
88 $(RSTRIP) $(IDIR_IPTABLES)
89 $(IPKG_BUILD) $(IDIR_IPTABLES) $(PACKAGE_DIR)
90
91 $(IPKG_IPTABLES_EXTRA):
92 $(IPKG_BUILD) $(IDIR_IPTABLES_EXTRA) $(PACKAGE_DIR)
93
94 $(IPKG_IPTABLES_UTILS):
95 install -d -m0755 $(IDIR_IPTABLES_UTILS)/usr/sbin
96 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(IDIR_IPTABLES_UTILS)/usr/sbin/
97 $(RSTRIP) $(IDIR_IPTABLES_UTILS)
98 $(IPKG_BUILD) $(IDIR_IPTABLES_UTILS) $(PACKAGE_DIR)
99
100 $(IPKG_IP6TABLES):
101 install -d -m0755 $(IDIR_IP6TABLES)/usr/sbin
102 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(IDIR_IP6TABLES)/usr/sbin/
103 install -d -m0755 $(IDIR_IP6TABLES)/usr/lib/iptables
104 (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
105 $(CP) libip6t_*.so $(IDIR_IP6TABLES)/usr/lib/iptables/ \
106 )
107 $(RSTRIP) $(IDIR_IP6TABLES)
108 $(IPKG_BUILD) $(IDIR_IP6TABLES) $(PACKAGE_DIR)
109
110 $(STAGING_DIR)/usr/lib/libipq.a: $(PKG_BUILD_DIR)/.built
111 mkdir -p $(STAGING_DIR)/usr/include
112 $(CP) $(PKG_INSTALL_DIR)/usr/include/libipq.h $(STAGING_DIR)/usr/include/
113 mkdir -p $(STAGING_DIR)/usr/lib
114 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libipq.a $(STAGING_DIR)/usr/lib/
115
116 layer7-install:
117 mkdir -p $(IDIR_IPTABLES_MOD_FILTER)/etc/l7-protocols
118 $(CP) files/l7/*.pat $(IDIR_IPTABLES_MOD_FILTER)/etc/l7-protocols/
119
120 install-dev: $(STAGING_DIR)/usr/lib/libipq.a
121
122 uninstall-dev:
123 rm -rf $(STAGING_DIR)/usr/include/libipq.h
124 rm -rf $(STAGING_DIR)/usr/lib/libipq.a
125
126 compile-targets: install-dev
127 clean-targets: uninstall-dev
This page took 0.046103 seconds and 5 git commands to generate.