38e493a6af17ce7495578a27b40d35549e83a5fe
[openwrt/svn-archive/archive.git] / package / iproute2 / Makefile
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
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=iproute2
11 PKG_VERSION:=2.6.39
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://devresources.linux-foundation.org/dev/iproute2/download/
16 PKG_MD5SUM:=8a3b6bc77c2ecf752284aa4a6fc630a6
17 PKG_BUILD_PARALLEL:=1
18
19 PKG_BUILD_DIR:=$(BUILD_DIR)/iproute2-$(PKG_VERSION)
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/iproute2/Default
24 SECTION:=net
25 CATEGORY:=Network
26 URL:=http://linux-net.osdl.org/index.php/Iproute2
27 endef
28
29 define Package/ip
30 $(call Package/iproute2/Default)
31 SUBMENU:=Routing and Redirection
32 TITLE:=Routing control utility
33 endef
34
35 define Package/ip/conffiles
36 /etc/iproute2/rt_tables
37 endef
38
39 define Package/tc
40 $(call Package/iproute2/Default)
41 TITLE:=Traffic control utility
42 DEPENDS:=+kmod-sched
43 endef
44
45 define Package/genl
46 $(call Package/iproute2/Default)
47 TITLE:=General netlink utility frontend
48 endef
49
50 define Build/Configure
51 $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
52 $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
53 $(PKG_BUILD_DIR)/Makefile
54 $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
55 $(PKG_BUILD_DIR)/Makefile
56 # For now disable compiling of the misc directory because it seems to fail
57 rm -rf $(PKG_BUILD_DIR)/misc
58 $(SED) "s, misc,," $(PKG_BUILD_DIR)/Makefile
59 echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
60 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
61 endef
62
63 MAKE_FLAGS += \
64 EXTRA_CCOPTS="$(TARGET_CFLAGS)" \
65 KERNEL_INCLUDE="$(LINUX_DIR)/include" \
66 FPIC="$(FPIC)"
67
68 define Build/Compile
69 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/netem \
70 HOSTCC="$(HOSTCC)" EXTRA_CCOPTS="$(TARGET_CFLAGS)" \
71 CFLAGS="-D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall \
72 -I../include -DRESOLVE_HOSTNAMES"
73 $(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) all
74 $(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/tc $(MAKE_FLAGS) tc
75 $(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/ip $(MAKE_FLAGS) ip
76 endef
77
78 define Build/InstallDev
79 $(INSTALL_DIR) $(1)/usr/include
80 $(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
81 $(INSTALL_DIR) $(1)/usr/lib
82 $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
83 endef
84
85 define Package/ip/install
86 $(INSTALL_DIR) $(1)/usr/sbin
87 $(INSTALL_DIR) $(1)/etc/iproute2
88 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/iproute2/rt_tables $(1)/etc/iproute2
89 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
90 endef
91
92 define Package/tc/install
93 $(INSTALL_DIR) $(1)/usr/sbin
94 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
95 endef
96
97 define Package/genl/install
98 $(INSTALL_DIR) $(1)/usr/sbin
99 $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
100 endef
101
102 $(eval $(call BuildPackage,ip))
103 $(eval $(call BuildPackage,tc))
104 $(eval $(call BuildPackage,genl))