d9c0c585d11d8363e523ff690da5989bb0d6620f
[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.0
8 PKG_RELEASE := 1
9 PKG_MD5SUM := a072c0f09f1b289cb7af56f76407d033
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 := $(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 $(PKG_IPT): $(PKG_BUILD_DIR)/iptables
67 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT) control/iptables.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
68 mkdir -p $(I_IPT)/usr/sbin
69 cp -af $(PKG_BUILD_DIR)/iptables $(I_IPT)/usr/sbin/
70 $(STRIP) $(I_IPT)/usr/sbin/iptables
71 mkdir -p $(I_IPT)/usr/lib/iptables
72 (cd $(PKG_BUILD_DIR)/extensions; \
73 cp $(patsubst %,libipt_%.so,$(ext-y)) $(I_IPT)/usr/lib/iptables)
74 -$(STRIP) $(I_IPT)/usr/lib/iptables/*.so
75 mkdir -p $(PACKAGE_DIR)
76 $(IPKG_BUILD) $(I_IPT) $(PACKAGE_DIR)
77
78 $(IPKG_STATE_DIR)/info/iptables.list: $(PKG_IPT)
79 $(IPKG) install $(PKG_IPT)
80
81 $(PKG_IPT_EXTRA): $(PKG_BUILD_DIR)/iptables
82 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT_EXTRA) control/iptables-extra.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
83 mkdir -p $(I_IPT_EXTRA)/usr/lib/iptables
84 (cd $(PKG_BUILD_DIR)/extensions; \
85 cp $(patsubst %,libipt_%.so,$(ext-m)) $(I_IPT_EXTRA)/usr/lib/iptables)
86 -$(STRIP) $(I_IPT_EXTRA)/usr/lib/iptables/*.so
87 mkdir -p $(PACKAGE_DIR)
88 $(IPKG_BUILD) $(I_IPT_EXTRA) $(PACKAGE_DIR)
89
90 $(IPKG_STATE_DIR)/info/iptables-extra.list: $(PKG_IPT)
91 $(IPKG) install $(PKG_IPT_EXTRA)
92
93 $(PKG_IPT_UTILS): $(PKG_BUILD_DIR)/iptables
94 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IPT_UTILS) control/iptables-utils.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
95 mkdir -p $(I_IPT_UTILS)/usr/sbin
96 cp $(PKG_BUILD_DIR)/iptables-save $(I_IPT_UTILS)/usr/sbin
97 cp $(PKG_BUILD_DIR)/iptables-restore $(I_IPT_UTILS)/usr/sbin
98 -$(STRIP) $(I_IPT_UTILS)/usr/sbin/*
99 mkdir -p $(PACKAGE_DIR)
100 $(IPKG_BUILD) $(I_IPT_UTILS) $(PACKAGE_DIR)
101
102 $(IPKG_STATE_DIR)/info/iptables-utils.list: $(PKG_IPT)
103 $(IPKG) install $(PKG_IPT_UTILS)
104
105 $(PKG_IP6T): $(PKG_BUILD_DIR)/iptables
106 $(SCRIPT_DIR)/make-ipkg-dir.sh $(I_IP6T) control/ip6tables.control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
107 mkdir -p $(I_IP6T)/usr/sbin
108 cp -af $(PKG_BUILD_DIR)/ip6tables $(I_IP6T)/usr/sbin/
109 $(STRIP) $(I_IP6T)/usr/sbin/ip6tables
110 mkdir -p $(I_IP6T)/usr/lib/iptables
111 (cd $(PKG_BUILD_DIR)/extensions; \
112 cp libip6t_*.so $(I_IP6T)/usr/lib/iptables)
113 -$(STRIP) $(I_IP6T)/usr/lib/iptables/*.so
114 mkdir -p $(PACKAGE_DIR)
115 $(IPKG_BUILD) $(I_IP6T) $(PACKAGE_DIR)
116
117 $(IPKG_STATE_DIR)/info/ip6tables.list: $(PKG_IP6T)
118 $(IPKG) install $(PKG_IP6T)
119
120
121 source: $(DL_DIR)/$(PKG_SOURCE_FILE)
122 prepare: $(PKG_BUILD_DIR)/.patched
123 compile: $(TARGETS)
124 install: $(INSTALL_TARGETS)
125
126 clean:
127 rm -rf $(PKG_BUILD_DIR)
128 rm -f $(PKG_IPT) $(PKG_IPT_EXTRA) $(PKG_IP6T)
This page took 0.046458 seconds and 3 git commands to generate.