update iptables to 1.3.1 and build/copy libipq.a+includes
[openwrt.git] / openwrt / 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
75 $(PKG_IPT): $(PKG_BUILD_DIR)/iptables
76 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT) control/iptables.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
77 mkdir -p $(I_IPT)/usr/sbin
78 cp -af $(PKG_BUILD_DIR)/iptables $(I_IPT)/usr/sbin/
79 $(STRIP) $(I_IPT)/usr/sbin/iptables
80 mkdir -p $(I_IPT)/usr/lib/iptables
81 (cd $(PKG_BUILD_DIR)/extensions; \
82 cp $(patsubst %,libipt_%.so,$(ext-y)) $(I_IPT)/usr/lib/iptables)
83 -$(STRIP) $(I_IPT)/usr/lib/iptables/*.so
84 mkdir -p $(PACKAGE_DIR)
85 $(IPKG_BUILD) $(I_IPT) $(PACKAGE_DIR)
86
87 $(IPKG_STATE_DIR)/info/iptables.list: $(PKG_IPT)
88 $(IPKG) install $(PKG_IPT)
89
90 $(PKG_IPT_EXTRA): $(PKG_BUILD_DIR)/iptables
91 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT_EXTRA) control/iptables-extra.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
92 mkdir -p $(I_IPT_EXTRA)/usr/lib/iptables
93 (cd $(PKG_BUILD_DIR)/extensions; \
94 cp $(patsubst %,libipt_%.so,$(ext-m)) $(I_IPT_EXTRA)/usr/lib/iptables)
95 -$(STRIP) $(I_IPT_EXTRA)/usr/lib/iptables/*.so
96 mkdir -p $(PACKAGE_DIR)
97 $(IPKG_BUILD) $(I_IPT_EXTRA) $(PACKAGE_DIR)
98
99 $(IPKG_STATE_DIR)/info/iptables-extra.list: $(PKG_IPT)
100 $(IPKG) install $(PKG_IPT_EXTRA)
101
102 $(PKG_IPT_UTILS): $(PKG_BUILD_DIR)/iptables
103 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT_UTILS) control/iptables-utils.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
104 mkdir -p $(I_IPT_UTILS)/usr/sbin
105 cp $(PKG_BUILD_DIR)/iptables-save $(I_IPT_UTILS)/usr/sbin
106 cp $(PKG_BUILD_DIR)/iptables-restore $(I_IPT_UTILS)/usr/sbin
107 -$(STRIP) $(I_IPT_UTILS)/usr/sbin/*
108 mkdir -p $(PACKAGE_DIR)
109 $(IPKG_BUILD) $(I_IPT_UTILS) $(PACKAGE_DIR)
110
111 $(IPKG_STATE_DIR)/info/iptables-utils.list: $(PKG_IPT)
112 $(IPKG) install $(PKG_IPT_UTILS)
113
114 $(PKG_IP6T): $(PKG_BUILD_DIR)/iptables
115 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IP6T) control/ip6tables.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
116 mkdir -p $(I_IP6T)/usr/sbin
117 cp -af $(PKG_BUILD_DIR)/ip6tables $(I_IP6T)/usr/sbin/
118 $(STRIP) $(I_IP6T)/usr/sbin/ip6tables
119 mkdir -p $(I_IP6T)/usr/lib/iptables
120 (cd $(PKG_BUILD_DIR)/extensions; \
121 cp libip6t_*.so $(I_IP6T)/usr/lib/iptables)
122 -$(STRIP) $(I_IP6T)/usr/lib/iptables/*.so
123 mkdir -p $(PACKAGE_DIR)
124 $(IPKG_BUILD) $(I_IP6T) $(PACKAGE_DIR)
125
126 $(IPKG_STATE_DIR)/info/ip6tables.list: $(PKG_IP6T)
127 $(IPKG) install $(PKG_IP6T)
128
129
130 source: $(DL_DIR)/$(PKG_SOURCE_FILE)
131 prepare: $(PKG_BUILD_DIR)/.patched
132 compile: $(TARGETS)
133 install: $(INSTALL_TARGETS)
134
135 clean:
136 rm -rf $(PKG_BUILD_DIR)
137 rm -f $(PKG_IPT) $(PKG_IPT_EXTRA) $(PKG_IP6T)
This page took 0.051645 seconds and 5 git commands to generate.