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 $(DL_DIR
)/$(PKG_SOURCE_FILE
):
33 $(WGET
) -P
$(DL_DIR
) $(PKG_SOURCE_SITE
)/$(PKG_SOURCE_FILE
)
35 $(PKG_BUILD_DIR
)/.patched
: $(DL_DIR
)/$(PKG_SOURCE_FILE
)
36 mkdir
-p
$(PKG_BUILD_DIR
)/modules
37 $(PKG_SOURCE_CAT
) $(DL_DIR
)/$(PKG_SOURCE_FILE
) |
tar -C
$(BUILD_DIR
) $(TAR_OPTIONS
) -
38 $(PATCH
) $(PKG_BUILD_DIR
) .
/patches
39 touch
$(PKG_BUILD_DIR
)/.patched
41 $(PKG_BUILD_DIR
)/iptables
: $(PKG_BUILD_DIR
)/.patched
42 $(TARGET_CONFIGURE_OPTS
) \
43 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
44 KERNEL_DIR
=$(LINUX_DIR
) PREFIX
=/usr \
45 CC
=$(TARGET_CC
) COPT_FLAGS
="$(TARGET_CFLAGS)"
47 $(PKG_IPT
): $(PKG_BUILD_DIR
)/iptables
48 $(SCRIPT_DIR
)/make-ipkg-dir.sh
$(I_IPT
) control
/iptables.control
$(PKG_VERSION
)-$(PKG_RELEASE
) $(ARCH
)
49 mkdir
-p
$(I_IPT
)/usr
/sbin
50 cp
-af
$(PKG_BUILD_DIR
)/iptables
$(I_IPT
)/usr
/sbin
/
51 $(STRIP
) $(I_IPT
)/usr
/sbin
/iptables
52 mkdir
-p
$(I_IPT
)/usr
/lib
/iptables
53 (cd
$(PKG_BUILD_DIR
)/extensions
; \
54 cp
$(patsubst %,libipt_
%.so
,$(ext-y
)) $(I_IPT
)/usr
/lib
/iptables
)
55 -$(STRIP
) $(I_IPT
)/usr
/lib
/iptables
/*.so
56 mkdir
-p
$(I_IPT_EXTRA
)/$(MODULES_SUBDIR
)
57 cp
$(MODULES_DIR
)/kernel
/net
/ipv6
/netfilter
/*.o
$(I_IPT_EXTRA
)/$(MODULES_SUBDIR
)
58 mkdir
-p
$(PACKAGE_DIR
)
59 $(IPKG_BUILD
) $(I_IPT
) $(PACKAGE_DIR
)
61 $(PKG_IPT_EXTRA
): $(PKG_BUILD_DIR
)/iptables
62 $(SCRIPT_DIR
)/make-ipkg-dir.sh
$(I_IPT_EXTRA
) control
/iptables-extra.control
$(PKG_VERSION
)-$(PKG_RELEASE
) $(ARCH
)
63 mkdir
-p
$(I_IPT_EXTRA
)/usr
/lib
/iptables
64 (cd
$(PKG_BUILD_DIR
)/extensions
; \
65 cp
$(patsubst %,libipt_
%.so
,$(ext-m
)) $(I_IPT_EXTRA
)/usr
/lib
/iptables
)
66 -$(STRIP
) $(I_IPT_EXTRA
)/usr
/lib
/iptables
/*.so
67 mkdir
-p
$(PACKAGE_DIR
)
68 $(IPKG_BUILD
) $(I_IPT_EXTRA
) $(PACKAGE_DIR
)
70 $(PKG_IP6T
): $(PKG_BUILD_DIR
)/iptables
71 $(SCRIPT_DIR
)/make-ipkg-dir.sh
$(I_IP6T
) control
/ip6tables.control
$(PKG_VERSION
)-$(PKG_RELEASE
) $(ARCH
)
72 mkdir
-p
$(I_IP6T
)/usr
/sbin
73 cp
-af
$(PKG_BUILD_DIR
)/ip6tables
$(I_IP6T
)/usr
/sbin
/
74 $(STRIP
) $(I_IP6T
)/usr
/sbin
/ip6tables
75 mkdir
-p
$(I_IP6T
)/usr
/lib
/iptables
76 (cd
$(PKG_BUILD_DIR
)/extensions
; \
77 cp libip6t_
*.so
$(I_IP6T
)/usr
/lib
/iptables
)
78 -$(STRIP
) $(I_IP6T
)/usr
/lib
/iptables
/*.so
79 mkdir
-p
$(PACKAGE_DIR
)
80 $(IPKG_BUILD
) $(I_IP6T
) $(PACKAGE_DIR
)
83 source
: $(DL_DIR
)/$(PKG_SOURCE_FILE
)
84 prepare
: $(PKG_BUILD_DIR
)/.patched
87 $(IPKG
) install $(PKG_IPT
)
88 ifeq ($(BR2_PACKAGE_IPTABLES_EXTRA
),y
)
89 $(IPKG
) install $(PKG_IPT_EXTRA
)
91 ifeq ($(BR2_PACKAGE_IP6TABLES
),y
)
92 $(IPKG
) install $(PKG_IP6T
)
96 rm -rf
$(PKG_BUILD_DIR
)