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