Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #
  2. # Copyright (C) 2006-2010 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=iproute2
  9. PKG_VERSION:=2.6.35
  10. PKG_RELEASE:=2
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  12. PKG_SOURCE_URL:=http://devresources.linux-foundation.org/dev/iproute2/download/
  13. PKG_MD5SUM:=b0f281b3124bf04669e18f5fe16d4934
  14. PKG_BUILD_PARALLEL:=1
  15. PKG_BUILD_DIR:=$(BUILD_DIR)/iproute2-$(PKG_VERSION)
  16. include $(INCLUDE_DIR)/package.mk
  17. define Package/iproute2/Default
  18. SECTION:=net
  19. CATEGORY:=Network
  20. URL:=http://linux-net.osdl.org/index.php/Iproute2
  21. endef
  22. define Package/ip
  23. $(call Package/iproute2/Default)
  24. TITLE:=Routing control utility
  25. endef
  26. define Package/tc
  27. $(call Package/iproute2/Default)
  28. TITLE:=Traffic control utility
  29. DEPENDS:=+kmod-sched
  30. endef
  31. define Package/genl
  32. $(call Package/iproute2/Default)
  33. TITLE:=General netlink utility frontend
  34. endef
  35. define Build/Configure
  36. $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
  37. $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
  38. $(PKG_BUILD_DIR)/Makefile
  39. $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
  40. $(PKG_BUILD_DIR)/Makefile
  41. # For now disable compiling of the misc directory because it seems to fail
  42. rm -rf $(PKG_BUILD_DIR)/misc
  43. $(SED) "s, misc,," $(PKG_BUILD_DIR)/Makefile
  44. echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
  45. > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
  46. endef
  47. MAKE_FLAGS += \
  48. EXTRA_CCOPTS="$(TARGET_CFLAGS)" \
  49. KERNEL_INCLUDE="$(LINUX_DIR)/include" \
  50. FPIC="$(FPIC)"
  51. define Build/Compile
  52. $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/netem \
  53. HOSTCC="$(HOSTCC)" EXTRA_CCOPTS="$(TARGET_CFLAGS)" \
  54. CFLAGS="-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall \
  55. -I../include -DRESOLVE_HOSTNAMES"
  56. $(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) all
  57. $(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/tc $(MAKE_FLAGS) tc
  58. $(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/ip $(MAKE_FLAGS) ip
  59. endef
  60. define Build/InstallDev
  61. $(INSTALL_DIR) $(1)/usr/include
  62. $(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
  63. $(INSTALL_DIR) $(1)/usr/lib
  64. $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
  65. endef
  66. define Package/ip/install
  67. $(INSTALL_DIR) $(1)/usr/sbin
  68. $(INSTALL_DIR) $(1)/etc/iproute2
  69. $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/iproute2/rt_tables $(1)/etc/iproute2
  70. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
  71. endef
  72. define Package/tc/install
  73. $(INSTALL_DIR) $(1)/usr/sbin
  74. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
  75. endef
  76. define Package/genl/install
  77. $(INSTALL_DIR) $(1)/usr/sbin
  78. $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
  79. endef
  80. $(eval $(call BuildPackage,ip))
  81. $(eval $(call BuildPackage,tc))
  82. $(eval $(call BuildPackage,genl))