2f12dbd1fba39abac1f04db312978fdcde0657c0
[openwrt.git] / package / iptables / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4 include kernelconfig.mk
5
6 PKG_NAME := iptables
7 PKG_VERSION := 1.3.1
8 PKG_RELEASE := 1
9 PKG_MD5SUM := c3358a3bd0d7755df0b64a5063db296b
10
11 PKG_SOURCE_SITE := http://www.netfilter.org/files
12 PKG_SOURCE_FILE := $(PKG_NAME)-$(PKG_VERSION).tar.bz2
13 PKG_SOURCE_CAT := bzcat
14 PKG_SOURCE_DIR := $(PKG_NAME)-$(PKG_VERSION)
15
16 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR)
17
18 PKG_IPT := $(PACKAGE_DIR)/iptables_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
19 PKG_IPT_UTILS := $(PACKAGE_DIR)/iptables-utils_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
20 PKG_IPT_EXTRA := $(PACKAGE_DIR)/iptables-extra_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
21 PKG_IP6T := $(PACKAGE_DIR)/ip6tables_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
22
23 I_IPT := $(PKG_BUILD_DIR)/ipkg/iptables
24 I_IPT_UTILS := $(PKG_BUILD_DIR)/ipkg/iptables-utils
25 I_IPT_EXTRA := $(PKG_BUILD_DIR)/ipkg/iptables-extra
26 I_IP6T := $(PKG_BUILD_DIR)/ipkg/ip6tables
27
28 TARGETS := $(STAGING_DIR)/libipq/libipq.a $(PKG_IPT)
29 ifneq ($(BR2_PACKAGE_IPTABLES_UTILS),)
30 TARGETS += $(PKG_IPT_UTILS)
31 endif
32 ifneq ($(BR2_PACKAGE_IPTABLES_EXTRA),)
33 TARGETS += $(PKG_IPT_EXTRA)
34 endif
35 ifneq ($(BR2_PACKAGE_IP6TABLES),)
36 TARGETS += $(PKG_IP6T)
37 endif
38
39 INSTALL_TARGETS := $(IPKG_STATE_DIR)/info/iptables.list
40 ifeq ($(BR2_PACKAGE_IPTABLES_UTILS),y)
41 INSTALL_TARGETS += $(IPKG_STATE_DIR)/info/iptables-utils.list
42 endif
43 ifeq ($(BR2_PACKAGE_IPTABLES_EXTRA),y)
44 INSTALL_TARGETS += $(IPKG_STATE_DIR)/info/iptables-extra.list
45 endif
46 ifeq ($(BR2_PACKAGE_IP6TABLES),y)
47 INSTALL_TARGETS += $(IPKG_STATE_DIR)/info/ip6tables.list
48 endif
49
50 $(DL_DIR)/$(PKG_SOURCE_FILE):
51 mkdir -p $(DL_DIR)
52 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE_FILE) $(PKG_MD5SUM) $(PKG_SOURCE_SITE)
53
54 $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE)
55 mkdir -p $(PKG_BUILD_DIR)/modules
56 $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
57 $(PATCH) $(PKG_BUILD_DIR) ./patches
58 touch $(PKG_BUILD_DIR)/.patched
59
60 $(PKG_BUILD_DIR)/iptables: $(PKG_BUILD_DIR)/.patched
61 $(TARGET_CONFIGURE_OPTS) \
62 $(MAKE) -C $(PKG_BUILD_DIR) \
63 KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
64 CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)"
65
66 $(STAGING_DIR)/libipq/libipq.a: $(PKG_BUILD_DIR)/iptables
67 $(TARGET_CONFIGURE_OPTS) \
68 $(MAKE) -C $(PKG_BUILD_DIR) \
69 KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
70 CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \
71 libipq/libipq.a
72 cp -a $(PKG_BUILD_DIR)/include/* $(STAGING_DIR)/include/
73 cp $(PKG_BUILD_DIR)/libipq/libipq.a $(STAGING_DIR)/lib/
74 cp $(PKG_BUILD_DIR)/libiptc/libiptc.a $(STAGING_DIR)/lib/
75
76 $(PKG_IPT): $(PKG_BUILD_DIR)/iptables
77 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT) control/iptables.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
78 mkdir -p $(I_IPT)/usr/sbin
79 cp -af $(PKG_BUILD_DIR)/iptables $(I_IPT)/usr/sbin/
80 $(STRIP) $(I_IPT)/usr/sbin/iptables
81 mkdir -p $(I_IPT)/usr/lib/iptables
82 (cd $(PKG_BUILD_DIR)/extensions; \
83 cp $(patsubst %,libipt_%.so,$(ext-y)) $(I_IPT)/usr/lib/iptables)
84 -$(STRIP) $(I_IPT)/usr/lib/iptables/*.so
85 mkdir -p $(PACKAGE_DIR)
86 $(IPKG_BUILD) $(I_IPT) $(PACKAGE_DIR)
87
88 $(IPKG_STATE_DIR)/info/iptables.list: $(PKG_IPT)
89 $(IPKG) install $(PKG_IPT)
90
91 $(PKG_IPT_EXTRA): $(PKG_BUILD_DIR)/iptables
92 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT_EXTRA) control/iptables-extra.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
93 mkdir -p $(I_IPT_EXTRA)/usr/lib/iptables
94 (cd $(PKG_BUILD_DIR)/extensions; \
95 cp $(patsubst %,libipt_%.so,$(ext-m)) $(I_IPT_EXTRA)/usr/lib/iptables)
96 -$(STRIP) $(I_IPT_EXTRA)/usr/lib/iptables/*.so
97 mkdir -p $(PACKAGE_DIR)
98 $(IPKG_BUILD) $(I_IPT_EXTRA) $(PACKAGE_DIR)
99
100 $(IPKG_STATE_DIR)/info/iptables-extra.list: $(PKG_IPT)
101 $(IPKG) install $(PKG_IPT_EXTRA)
102
103 $(PKG_IPT_UTILS): $(PKG_BUILD_DIR)/iptables
104 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT_UTILS) control/iptables-utils.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
105 mkdir -p $(I_IPT_UTILS)/usr/sbin
106 cp $(PKG_BUILD_DIR)/iptables-save $(I_IPT_UTILS)/usr/sbin
107 cp $(PKG_BUILD_DIR)/iptables-restore $(I_IPT_UTILS)/usr/sbin
108 -$(STRIP) $(I_IPT_UTILS)/usr/sbin/*
109 mkdir -p $(PACKAGE_DIR)
110 $(IPKG_BUILD) $(I_IPT_UTILS) $(PACKAGE_DIR)
111
112 $(IPKG_STATE_DIR)/info/iptables-utils.list: $(PKG_IPT)
113 $(IPKG) install $(PKG_IPT_UTILS)
114
115 $(PKG_IP6T): $(PKG_BUILD_DIR)/iptables
116 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IP6T) control/ip6tables.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
117 mkdir -p $(I_IP6T)/usr/sbin
118 cp -af $(PKG_BUILD_DIR)/ip6tables $(I_IP6T)/usr/sbin/
119 $(STRIP) $(I_IP6T)/usr/sbin/ip6tables
120 mkdir -p $(I_IP6T)/usr/lib/iptables
121 (cd $(PKG_BUILD_DIR)/extensions; \
122 cp libip6t_*.so $(I_IP6T)/usr/lib/iptables)
123 -$(STRIP) $(I_IP6T)/usr/lib/iptables/*.so
124 mkdir -p $(PACKAGE_DIR)
125 $(IPKG_BUILD) $(I_IP6T) $(PACKAGE_DIR)
126
127 $(IPKG_STATE_DIR)/info/ip6tables.list: $(PKG_IP6T)
128 $(IPKG) install $(PKG_IP6T)
129
130
131 source: $(DL_DIR)/$(PKG_SOURCE_FILE)
132 prepare: $(PKG_BUILD_DIR)/.patched
133 compile: $(TARGETS)
134 install: $(INSTALL_TARGETS)
135
136 clean:
137 rm -rf $(PKG_BUILD_DIR)
138 rm -f $(PKG_IPT) $(PKG_IPT_EXTRA) $(PKG_IP6T)
This page took 0.053157 seconds and 3 git commands to generate.