Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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/ip/conffiles
  27. /etc/iproute2/rt_tables
  28. endef
  29. define Package/tc
  30. $(call Package/iproute2/Default)
  31. TITLE:=Traffic control utility
  32. DEPENDS:=+kmod-sched
  33. endef
  34. define Package/genl
  35. $(call Package/iproute2/Default)
  36. TITLE:=General netlink utility frontend
  37. endef
  38. define Build/Configure
  39. $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
  40. $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
  41. $(PKG_BUILD_DIR)/Makefile
  42. $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
  43. $(PKG_BUILD_DIR)/Makefile
  44. # For now disable compiling of the misc directory because it seems to fail
  45. rm -rf $(PKG_BUILD_DIR)/misc
  46. $(SED) "s, misc,," $(PKG_BUILD_DIR)/Makefile
  47. echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
  48. > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
  49. endef
  50. MAKE_FLAGS += \
  51. EXTRA_CCOPTS="$(TARGET_CFLAGS)" \
  52. KERNEL_INCLUDE="$(LINUX_DIR)/include" \
  53. FPIC="$(FPIC)"
  54. define Build/Compile
  55. $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/netem \
  56. HOSTCC="$(HOSTCC)" EXTRA_CCOPTS="$(TARGET_CFLAGS)" \
  57. CFLAGS="-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall \
  58. -I../include -DRESOLVE_HOSTNAMES"
  59. $(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) all
  60. $(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/tc $(MAKE_FLAGS) tc
  61. $(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/ip $(MAKE_FLAGS) ip
  62. endef
  63. define Build/InstallDev
  64. $(INSTALL_DIR) $(1)/usr/include
  65. $(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
  66. $(INSTALL_DIR) $(1)/usr/lib
  67. $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
  68. endef
  69. define Package/ip/install
  70. $(INSTALL_DIR) $(1)/usr/sbin
  71. $(INSTALL_DIR) $(1)/etc/iproute2
  72. $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/iproute2/rt_tables $(1)/etc/iproute2
  73. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
  74. endef
  75. define Package/tc/install
  76. $(INSTALL_DIR) $(1)/usr/sbin
  77. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
  78. endef
  79. define Package/genl/install
  80. $(INSTALL_DIR) $(1)/usr/sbin
  81. $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
  82. endef
  83. $(eval $(call BuildPackage,ip))
  84. $(eval $(call BuildPackage,tc))
  85. $(eval $(call BuildPackage,genl))