/package/iptables/Makefile

https://github.com/ZigFisher/FlyRouter · Makefile · 144 lines · 111 code · 23 blank · 10 comment · 4 complexity · 404d5b189cd7a6c6f4baf2d31abe6121 MD5 · raw file

  1. # $Id: Makefile 3713 2006-04-29 21:43:26Z nbd $
  2. include $(TOPDIR)/rules.mk
  3. PKG_NAME:=iptables
  4. PKG_VERSION:=1.3.5
  5. PKG_RELEASE:=1
  6. PKG_MD5SUM:=00fb916fa8040ca992a5ace56d905ea5
  7. PKG_SOURCE_URL:=http://www.netfilter.org/projects/iptables/files \
  8. ftp://ftp.be.netfilter.org/pub/netfilter/iptables/ \
  9. ftp://ftp.de.netfilter.org/pub/netfilter/iptables/ \
  10. ftp://ftp.no.netfilter.org/pub/netfilter/iptables/
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  12. PKG_CAT:=bzcat
  13. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
  14. PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
  15. ifeq ($(BUSYBOX_CONFIG_FEATURE_IPV6),)
  16. EXTRA_PARAM=DO_IPV6=0
  17. else
  18. EXTRA_PARAM=DO_IPV6=1
  19. endif
  20. define IPKG_plugin_template
  21. $$(IPKG_$(1)):
  22. install -m0755 -d $$(IDIR_$(1))/usr/lib/iptables
  23. for m in $(2); do \
  24. m1=`basename $$$${m}|sed s/xt_/ipt_/g`; \
  25. if [ -r $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m1}.so ]; then \
  26. $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m1}.so $$(IDIR_$(1))/usr/lib/iptables/; \
  27. else \
  28. echo " Module $(PKG_INSTALL_DIR)/usr/lib/iptables/lib$$$${m1}.so not found" ; \
  29. exit 1; \
  30. fi; \
  31. done
  32. @[ -z "$(3)" ] || $(MAKE) $(3)
  33. $(RSTRIP) $$(IDIR_$(1))
  34. $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
  35. endef
  36. include $(TOPDIR)/package/rules.mk
  37. include $(LINUX_DIR)/.config
  38. include $(TOPDIR)/target/linux/netfilter.mk
  39. $(eval $(call PKG_template,IPTABLES,iptables,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
  40. $(eval $(call PKG_template,IPTABLES_EXTRA,iptables-extra,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
  41. $(eval $(call PKG_template,IPTABLES_UTILS,iptables-utils,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
  42. ifneq ($(BUSYBOX_CONFIG_FEATURE_IPV6),)
  43. $(eval $(call PKG_template,IP6TABLES,ip6tables,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
  44. endif
  45. $(eval $(call PKG_template,IPTABLES_MOD_CONNTRACK,iptables-mod-conntrack,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
  46. $(eval $(call PKG_template,IPTABLES_MOD_EXTRA,iptables-mod-extra,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
  47. $(eval $(call PKG_template,IPTABLES_MOD_FILTER,iptables-mod-filter,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
  48. $(eval $(call PKG_template,IPTABLES_MOD_IMQ,iptables-mod-imq,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
  49. $(eval $(call PKG_template,IPTABLES_MOD_IPOPT,iptables-mod-ipopt,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
  50. $(eval $(call PKG_template,IPTABLES_MOD_IPSEC,iptables-mod-ipsec,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
  51. $(eval $(call PKG_template,IPTABLES_MOD_NAT,iptables-mod-nat,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
  52. $(eval $(call PKG_template,IPTABLES_MOD_ULOG,iptables-mod-ulog,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
  53. $(eval $(call IPKG_plugin_template,IPTABLES_MOD_CONNTRACK,$(IPT_CONNTRACK-m)))
  54. $(eval $(call IPKG_plugin_template,IPTABLES_MOD_EXTRA,$(IPT_EXTRA-m)))
  55. $(eval $(call IPKG_plugin_template,IPTABLES_MOD_FILTER,$(IPT_FILTER-m),layer7-install))
  56. $(eval $(call IPKG_plugin_template,IPTABLES_MOD_IMQ,$(IPT_IMQ-m)))
  57. $(eval $(call IPKG_plugin_template,IPTABLES_MOD_IPOPT,$(IPT_IPOPT-m)))
  58. $(eval $(call IPKG_plugin_template,IPTABLES_MOD_IPSEC,$(IPT_IPSEC-m)))
  59. $(eval $(call IPKG_plugin_template,IPTABLES_MOD_NAT,$(IPT_NAT-m) ipt_SNAT ipt_DNAT))
  60. $(eval $(call IPKG_plugin_template,IPTABLES_MOD_ULOG,$(IPT_ULOG-m)))
  61. $(PKG_BUILD_DIR)/.configured:
  62. touch $@
  63. $(PKG_BUILD_DIR)/.built:
  64. chmod a+x $(PKG_BUILD_DIR)/extensions/.*-test*
  65. mkdir -p $(PKG_INSTALL_DIR)
  66. $(MAKE) -C $(PKG_BUILD_DIR) \
  67. $(TARGET_CONFIGURE_OPTS) \
  68. CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \
  69. KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
  70. DESTDIR="$(PKG_INSTALL_DIR)" $(EXTRA_PARAM) \
  71. all install install-devel
  72. touch $@
  73. $(IPKG_IPTABLES):
  74. #install -d -m0755 $(IDIR_IPTABLES)/etc/config
  75. #install -m0644 ./files/firewall.config $(IDIR_IPTABLES)/etc/config/firewall
  76. #install -d -m0755 $(IDIR_IPTABLES)/etc/init.d
  77. #install -m0755 ./files/firewall.init $(IDIR_IPTABLES)/etc/init.d/S45firewall
  78. #install -m0755 ./files/firewall.user $(IDIR_IPTABLES)/etc/
  79. #install -d -m0755 $(IDIR_IPTABLES)/usr/lib
  80. #install -m0644 ./files/firewall.awk $(IDIR_IPTABLES)/usr/lib
  81. install -d -m0755 $(IDIR_IPTABLES)/usr/sbin
  82. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables $(IDIR_IPTABLES)/usr/sbin/
  83. install -d -m0755 $(IDIR_IPTABLES)/usr/lib/iptables
  84. (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
  85. $(CP) $(patsubst %,lib%.so,$(IPT_BUILTIN:xt_%=ipt_%)) $(IDIR_IPTABLES)/usr/lib/iptables/ \
  86. )
  87. $(RSTRIP) $(IDIR_IPTABLES)
  88. $(IPKG_BUILD) $(IDIR_IPTABLES) $(PACKAGE_DIR)
  89. $(IPKG_IPTABLES_EXTRA):
  90. $(IPKG_BUILD) $(IDIR_IPTABLES_EXTRA) $(PACKAGE_DIR)
  91. $(IPKG_IPTABLES_UTILS):
  92. install -d -m0755 $(IDIR_IPTABLES_UTILS)/usr/sbin
  93. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-{save,restore} $(IDIR_IPTABLES_UTILS)/usr/sbin/
  94. $(RSTRIP) $(IDIR_IPTABLES_UTILS)
  95. $(IPKG_BUILD) $(IDIR_IPTABLES_UTILS) $(PACKAGE_DIR)
  96. $(IPKG_IP6TABLES):
  97. install -d -m0755 $(IDIR_IP6TABLES)/usr/sbin
  98. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables $(IDIR_IP6TABLES)/usr/sbin/
  99. install -d -m0755 $(IDIR_IP6TABLES)/usr/lib/iptables
  100. (cd $(PKG_INSTALL_DIR)/usr/lib/iptables ; \
  101. $(CP) libip6t_*.so $(IDIR_IP6TABLES)/usr/lib/iptables/ \
  102. )
  103. $(RSTRIP) $(IDIR_IP6TABLES)
  104. $(IPKG_BUILD) $(IDIR_IP6TABLES) $(PACKAGE_DIR)
  105. $(STAGING_DIR)/usr/lib/libipq.a: $(PKG_BUILD_DIR)/.built
  106. $(MAKE) -C $(PKG_BUILD_DIR) \
  107. $(TARGET_CONFIGURE_OPTS) \
  108. CC=$(TARGET_CC) COPT_FLAGS="$(TARGET_CFLAGS)" \
  109. KERNEL_DIR=$(LINUX_DIR) PREFIX=/usr \
  110. DESTDIR="$(STAGING_DIR)" $(EXTRA_PARAM) \
  111. install install-devel
  112. layer7-install:
  113. echo "Not copy L7 files"
  114. #mkdir -p $(IDIR_IPTABLES_MOD_FILTER)/etc/l7-protocols
  115. #$(CP) files/l7/*.pat $(IDIR_IPTABLES_MOD_FILTER)/etc/l7-protocols/
  116. install-dev: $(STAGING_DIR)/usr/lib/libipq.a
  117. uninstall-dev:
  118. rm -rf $(STAGING_DIR)/usr/include/libipq.h
  119. rm -rf $(STAGING_DIR)/usr/lib/libipq.a
  120. compile-targets: install-dev
  121. clean-targets: uninstall-dev