add sample ppp options file
[openwrt.git] / package / iptables / Makefile
1 include $(TOPDIR)/rules.mk
2 include kernelconfig.mk
3
4 PKG_NAME := iptables
5 PKG_VERSION := 1.3.0
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 $(PACKAGE_DIR)
65 $(IPKG_BUILD) $(I_IPT) $(PACKAGE_DIR)
66
67 $(IPKG_STATE_DIR)/info/iptables.list: $(PKG_IPT)
68 $(IPKG) install $(PKG_IPT)
69
70 $(PKG_IPT_EXTRA): $(PKG_BUILD_DIR)/iptables
71 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT_EXTRA) control/iptables-extra.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
72 mkdir -p $(I_IPT_EXTRA)/usr/lib/iptables
73 (cd $(PKG_BUILD_DIR)/extensions; \
74 cp $(patsubst %,libipt_%.so,$(ext-m)) $(I_IPT_EXTRA)/usr/lib/iptables)
75 -$(STRIP) $(I_IPT_EXTRA)/usr/lib/iptables/*.so
76 mkdir -p $(PACKAGE_DIR)
77 $(IPKG_BUILD) $(I_IPT_EXTRA) $(PACKAGE_DIR)
78
79 $(IPKG_STATE_DIR)/info/iptables-extra.list: $(PKG_IPT)
80 $(IPKG) install $(PKG_IPT_EXTRA)
81
82 $(PKG_IP6T): $(PKG_BUILD_DIR)/iptables
83 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IP6T) control/ip6tables.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
84 mkdir -p $(I_IP6T)/usr/sbin
85 cp -af $(PKG_BUILD_DIR)/ip6tables $(I_IP6T)/usr/sbin/
86 $(STRIP) $(I_IP6T)/usr/sbin/ip6tables
87 mkdir -p $(I_IP6T)/usr/lib/iptables
88 (cd $(PKG_BUILD_DIR)/extensions; \
89 cp libip6t_*.so $(I_IP6T)/usr/lib/iptables)
90 -$(STRIP) $(I_IP6T)/usr/lib/iptables/*.so
91 mkdir -p $(PACKAGE_DIR)
92 $(IPKG_BUILD) $(I_IP6T) $(PACKAGE_DIR)
93
94 $(IPKG_STATE_DIR)/info/ip6tables.list: $(PKG_IP6T)
95 $(IPKG) install $(PKG_IP6T)
96
97
98 source: $(DL_DIR)/$(PKG_SOURCE_FILE)
99 prepare: $(PKG_BUILD_DIR)/.patched
100 compile: $(TARGETS)
101 install: $(INSTALL_TARGETS)
102
103 clean:
104 rm -rf $(PKG_BUILD_DIR)
105 rm -f $(PKG_IPT) $(PKG_IPT_EXTRA) $(PKG_IP6T)
This page took 0.061952 seconds and 5 git commands to generate.