67e4a2d737bff68cd97367f0265df648b083cbf0
[openwrt.git] / package / iptables / Makefile
1 include $(TOPDIR)/rules.mk
2 include kernelconfig.mk
3
4 PKG_NAME := iptables
5 PKG_VERSION := 1.2.11
6 PKG_RELEASE := 1
7
8 PKG_SOURCE_SITE := http://www.netfilter.org/files
9 PKG_SOURCE_FILE := $(PKG_NAME)-$(PKG_VERSION).tar.bz2
10 PKG_SOURCE_CAT := bzcat
11 PKG_SOURCE_DIR := $(PKG_NAME)-$(PKG_VERSION)
12
13 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR)
14
15 PKG_IPT := $(PACKAGE_DIR)/iptables_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
16 PKG_IPT_EXTRA := $(PACKAGE_DIR)/iptables-extra_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
17 PKG_IP6T := $(PACKAGE_DIR)/ip6tables_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
18
19 I_IPT := $(PKG_BUILD_DIR)/ipkg/iptables
20 I_IPT_EXTRA := $(PKG_BUILD_DIR)/ipkg/iptables-extra
21 I_IP6T := $(PKG_BUILD_DIR)/ipkg/ip6tables
22
23 TARGETS := $(PKG_IPT)
24 ifneq ($(BR2_PACKAGE_IPTABLES_EXTRA),)
25 TARGETS += $(PKG_IPT_EXTRA)
26 endif
27 ifneq ($(BR2_PACKAGE_IP6TABLES),)
28 TARGETS += $(PKG_IP6T)
29 endif
30
31 INSTALL_TARGETS := $(IPKG_STATE_DIR)/info/iptables.list
32 ifeq ($(BR2_PACKAGE_IPTABLES_EXTRA),y)
33 INSTALL_TARGETS += $(IPKG_STATE_DIR)/info/iptables-extra.list
34 endif
35 ifeq ($(BR2_PACKAGE_IP6TABLES),y)
36 INSTALL_TARGETS += $(IPKG_STATE_DIR)/info/ip6tables.list
37 endif
38
39 $(DL_DIR)/$(PKG_SOURCE_FILE):
40 mkdir -p $(DL_DIR)
41 $(WGET) -P $(DL_DIR) $(PKG_SOURCE_SITE)/$(PKG_SOURCE_FILE)
42
43 $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE)
44 mkdir -p $(PKG_BUILD_DIR)/modules
45 $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
46 $(PATCH) $(PKG_BUILD_DIR) ./patches
47 touch $(PKG_BUILD_DIR)/.patched
48
49 $(PKG_BUILD_DIR)/iptables: $(PKG_BUILD_DIR)/.patched
50 $(TARGET_CONFIGURE_OPTS) \
51 $(MAKE) -C $(PKG_BUILD_DIR) \
52 KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
53 CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)"
54
55 $(PKG_IPT): $(PKG_BUILD_DIR)/iptables
56 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT) control/iptables.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
57 mkdir -p $(I_IPT)/usr/sbin
58 cp -af $(PKG_BUILD_DIR)/iptables $(I_IPT)/usr/sbin/
59 $(STRIP) $(I_IPT)/usr/sbin/iptables
60 mkdir -p $(I_IPT)/usr/lib/iptables
61 (cd $(PKG_BUILD_DIR)/extensions; \
62 cp $(patsubst %,libipt_%.so,$(ext-y)) $(I_IPT)/usr/lib/iptables)
63 -$(STRIP) $(I_IPT)/usr/lib/iptables/*.so
64 mkdir -p $(I_IPT_EXTRA)/$(MODULES_SUBDIR)
65 cp $(MODULES_DIR)/kernel/net/ipv6/netfilter/*.o $(I_IPT_EXTRA)/$(MODULES_SUBDIR)
66 mkdir -p $(PACKAGE_DIR)
67 $(IPKG_BUILD) $(I_IPT) $(PACKAGE_DIR)
68
69 $(IPKG_STATE_DIR)/info/iptables.list: $(PKG_IPT)
70 $(IPKG) install $(PKG_IPT)
71
72 $(PKG_IPT_EXTRA): $(PKG_BUILD_DIR)/iptables
73 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT_EXTRA) control/iptables-extra.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
74 mkdir -p $(I_IPT_EXTRA)/usr/lib/iptables
75 (cd $(PKG_BUILD_DIR)/extensions; \
76 cp $(patsubst %,libipt_%.so,$(ext-m)) $(I_IPT_EXTRA)/usr/lib/iptables)
77 -$(STRIP) $(I_IPT_EXTRA)/usr/lib/iptables/*.so
78 mkdir -p $(PACKAGE_DIR)
79 $(IPKG_BUILD) $(I_IPT_EXTRA) $(PACKAGE_DIR)
80
81 $(IPKG_STATE_DIR)/info/iptables-extra.list: $(PKG_IPT)
82 $(IPKG) install $(PKG_IPT_EXTRA)
83
84 $(PKG_IP6T): $(PKG_BUILD_DIR)/iptables
85 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IP6T) control/ip6tables.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
86 mkdir -p $(I_IP6T)/usr/sbin
87 cp -af $(PKG_BUILD_DIR)/ip6tables $(I_IP6T)/usr/sbin/
88 $(STRIP) $(I_IP6T)/usr/sbin/ip6tables
89 mkdir -p $(I_IP6T)/usr/lib/iptables
90 (cd $(PKG_BUILD_DIR)/extensions; \
91 cp libip6t_*.so $(I_IP6T)/usr/lib/iptables)
92 -$(STRIP) $(I_IP6T)/usr/lib/iptables/*.so
93 mkdir -p $(PACKAGE_DIR)
94 $(IPKG_BUILD) $(I_IP6T) $(PACKAGE_DIR)
95
96 $(IPKG_STATE_DIR)/info/ip6tables.list: $(PKG_IP6T)
97 $(IPKG) install $(PKG_IP6T)
98
99
100 source: $(DL_DIR)/$(PKG_SOURCE_FILE)
101 prepare: $(PKG_BUILD_DIR)/.patched
102 compile: $(TARGETS)
103 install: $(INSTALL_TARGETS)
104
105 clean:
106 rm -rf $(PKG_BUILD_DIR)
107 rm -f $(PKG_IPT)
This page took 0.053616 seconds and 3 git commands to generate.