1 include $(TOPDIR
)/rules.mk
2 include kernelconfig.mk
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
)
13 PKG_BUILD_DIR
:= $(BUILD_DIR
)/$(PKG_SOURCE_DIR
)
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
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
24 ifneq ($(BR2_PACKAGE_IPTABLES_EXTRA
),)
25 TARGETS
+= $(PKG_IPT_EXTRA
)
27 ifneq ($(BR2_PACKAGE_IP6TABLES
),)
28 TARGETS
+= $(PKG_IP6T
)
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
35 ifeq ($(BR2_PACKAGE_IP6TABLES
),y
)
36 INSTALL_TARGETS
+= $(IPKG_STATE_DIR
)/info/ip6tables.list
39 $(DL_DIR
)/$(PKG_SOURCE_FILE
):
41 $(WGET
) -P
$(DL_DIR
) $(PKG_SOURCE_SITE
)/$(PKG_SOURCE_FILE
)
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
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)"
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
$(I_IPT_EXTRA
)/$(MODULES_SUBDIR
)
65 cp
$(MODULES_DIR
)/kernel
/net
/ipv6
/netfilter
/*.o
$(I_IPT_EXTRA
)/$(MODULES_SUBDIR
)
66 mkdir
-p
$(PACKAGE_DIR
)
67 $(IPKG_BUILD
) $(I_IPT
) $(PACKAGE_DIR
)
69 $(IPKG_STATE_DIR
)/info/iptables.list
: $(PKG_IPT
)
70 $(IPKG
) install $(PKG_IPT
)
72 $(PKG_IPT_EXTRA
): $(PKG_BUILD_DIR
)/iptables
73 $(SCRIPT_DIR
)/make-ipkg-dir.sh
$(I_IPT_EXTRA
) control
/iptables-extra.control
$(PKG_VERSION
)-$(PKG_RELEASE
) $(ARCH
)
74 mkdir
-p
$(I_IPT_EXTRA
)/usr
/lib
/iptables
75 (cd
$(PKG_BUILD_DIR
)/extensions
; \
76 cp
$(patsubst %,libipt_
%.so
,$(ext-m
)) $(I_IPT_EXTRA
)/usr
/lib
/iptables
)
77 -$(STRIP
) $(I_IPT_EXTRA
)/usr
/lib
/iptables
/*.so
78 mkdir
-p
$(PACKAGE_DIR
)
79 $(IPKG_BUILD
) $(I_IPT_EXTRA
) $(PACKAGE_DIR
)
81 $(IPKG_STATE_DIR
)/info/iptables-extra.list
: $(PKG_IPT
)
82 $(IPKG
) install $(PKG_IPT_EXTRA
)
84 $(PKG_IP6T
): $(PKG_BUILD_DIR
)/iptables
85 $(SCRIPT_DIR
)/make-ipkg-dir.sh
$(I_IP6T
) control
/ip6tables.control
$(PKG_VERSION
)-$(PKG_RELEASE
) $(ARCH
)
86 mkdir
-p
$(I_IP6T
)/usr
/sbin
87 cp
-af
$(PKG_BUILD_DIR
)/ip6tables
$(I_IP6T
)/usr
/sbin
/
88 $(STRIP
) $(I_IP6T
)/usr
/sbin
/ip6tables
89 mkdir
-p
$(I_IP6T
)/usr
/lib
/iptables
90 (cd
$(PKG_BUILD_DIR
)/extensions
; \
91 cp libip6t_
*.so
$(I_IP6T
)/usr
/lib
/iptables
)
92 -$(STRIP
) $(I_IP6T
)/usr
/lib
/iptables
/*.so
93 mkdir
-p
$(PACKAGE_DIR
)
94 $(IPKG_BUILD
) $(I_IP6T
) $(PACKAGE_DIR
)
96 $(IPKG_STATE_DIR
)/info/ip6tables.list
: $(PKG_IP6T
)
97 $(IPKG
) install $(PKG_IP6T
)
100 source
: $(DL_DIR
)/$(PKG_SOURCE_FILE
)
101 prepare
: $(PKG_BUILD_DIR
)/.patched
103 install: $(INSTALL_TARGETS
)
106 rm -rf
$(PKG_BUILD_DIR
)