Allow use of the offline_root option
[openwrt.git] / openwrt / 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 $(DL_DIR)/$(PKG_SOURCE_FILE):
32 mkdir -p $(DL_DIR)
33 $(WGET) -P $(DL_DIR) $(PKG_SOURCE_SITE)/$(PKG_SOURCE_FILE)
34
35 $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE)
36 mkdir -p $(PKG_BUILD_DIR)/modules
37 $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
38 $(PATCH) $(PKG_BUILD_DIR) ./patches
39 touch $(PKG_BUILD_DIR)/.patched
40
41 $(PKG_BUILD_DIR)/iptables: $(PKG_BUILD_DIR)/.patched
42 $(TARGET_CONFIGURE_OPTS) \
43 $(MAKE) -C $(PKG_BUILD_DIR) \
44 KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
45 CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)"
46
47 $(PKG_IPT): $(PKG_BUILD_DIR)/iptables
48 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT) control/iptables.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
49 mkdir -p $(I_IPT)/usr/sbin
50 cp -af $(PKG_BUILD_DIR)/iptables $(I_IPT)/usr/sbin/
51 $(STRIP) $(I_IPT)/usr/sbin/iptables
52 mkdir -p $(I_IPT)/usr/lib/iptables
53 (cd $(PKG_BUILD_DIR)/extensions; \
54 cp $(patsubst %,libipt_%.so,$(ext-y)) $(I_IPT)/usr/lib/iptables)
55 -$(STRIP) $(I_IPT)/usr/lib/iptables/*.so
56 mkdir -p $(I_IPT_EXTRA)/$(MODULES_SUBDIR)
57 cp $(MODULES_DIR)/kernel/net/ipv6/netfilter/*.o $(I_IPT_EXTRA)/$(MODULES_SUBDIR)
58 mkdir -p $(PACKAGE_DIR)
59 $(IPKG_BUILD) $(I_IPT) $(PACKAGE_DIR)
60
61 $(PKG_IPT_EXTRA): $(PKG_BUILD_DIR)/iptables
62 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT_EXTRA) control/iptables-extra.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
63 mkdir -p $(I_IPT_EXTRA)/usr/lib/iptables
64 (cd $(PKG_BUILD_DIR)/extensions; \
65 cp $(patsubst %,libipt_%.so,$(ext-m)) $(I_IPT_EXTRA)/usr/lib/iptables)
66 -$(STRIP) $(I_IPT_EXTRA)/usr/lib/iptables/*.so
67 mkdir -p $(PACKAGE_DIR)
68 $(IPKG_BUILD) $(I_IPT_EXTRA) $(PACKAGE_DIR)
69
70 $(PKG_IP6T): $(PKG_BUILD_DIR)/iptables
71 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IP6T) control/ip6tables.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
72 mkdir -p $(I_IP6T)/usr/sbin
73 cp -af $(PKG_BUILD_DIR)/ip6tables $(I_IP6T)/usr/sbin/
74 $(STRIP) $(I_IP6T)/usr/sbin/ip6tables
75 mkdir -p $(I_IP6T)/usr/lib/iptables
76 (cd $(PKG_BUILD_DIR)/extensions; \
77 cp libip6t_*.so $(I_IP6T)/usr/lib/iptables)
78 -$(STRIP) $(I_IP6T)/usr/lib/iptables/*.so
79 mkdir -p $(PACKAGE_DIR)
80 $(IPKG_BUILD) $(I_IP6T) $(PACKAGE_DIR)
81
82
83 source: $(DL_DIR)/$(PKG_SOURCE_FILE)
84 prepare: $(PKG_BUILD_DIR)/.patched
85 compile: $(TARGETS)
86 install: compile
87 $(IPKG) install $(PKG_IPT)
88 ifeq ($(BR2_PACKAGE_IPTABLES_EXTRA),y)
89 $(IPKG) install $(PKG_IPT_EXTRA)
90 endif
91 ifeq ($(BR2_PACKAGE_IP6TABLES),y)
92 $(IPKG) install $(PKG_IP6T)
93 endif
94
95 clean:
96 rm -rf $(PKG_BUILD_DIR)
97 rm -f $(PKG_IPT)
This page took 0.05347 seconds and 5 git commands to generate.