ipq40xx: only include ath10k-board-qca4019 for the generic subtarget
[openwrt/staging/chunkeey.git] / package / network / utils / iproute2 / Makefile
1 #
2 # Copyright (C) 2006-2015 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:=5.15.0
12 PKG_RELEASE:=$(AUTORELEASE)
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
16 PKG_HASH:=38e3e4a5f9a7f5575c015027a10df097c149111eeb739993128e5b2b35b291ff
17 PKG_BUILD_PARALLEL:=1
18 PKG_BUILD_DEPENDS:=iptables
19 PKG_LICENSE:=GPL-2.0
20 PKG_CPE_ID:=cpe:/a:iproute2_project:iproute2
21
22 include $(INCLUDE_DIR)/kernel.mk
23 include $(INCLUDE_DIR)/package.mk
24 include $(INCLUDE_DIR)/nls.mk
25
26 define Package/iproute2/Default
27 SECTION:=net
28 CATEGORY:=Network
29 URL:=http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
30 SUBMENU:=Routing and Redirection
31 MAINTAINER:=Russell Senior <russell@personaltelco.net>
32 endef
33
34 define Package/ip-tiny
35 $(call Package/iproute2/Default)
36 TITLE:=Routing control utility (minimal)
37 VARIANT:=iptiny
38 DEFAULT_VARIANT:=1
39 PROVIDES:=ip
40 ALTERNATIVES:=200:/sbin/ip:/usr/libexec/ip-tiny
41 DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
42 endef
43
44 define Package/ip-full
45 $(call Package/iproute2/Default)
46 TITLE:=Routing control utility (full)
47 VARIANT:=ipfull
48 PROVIDES:=ip
49 ALTERNATIVES:=300:/sbin/ip:/usr/libexec/ip-full
50 DEPENDS:=+libnl-tiny +libbpf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
51 endef
52
53 define Package/tc-tiny
54 $(call Package/iproute2/Default)
55 TITLE:=Traffic control utility (minimal)
56 VARIANT:=tctiny
57 DEFAULT_VARIANT:=1
58 PROVIDES:=tc
59 ALTERNATIVES:=200:/sbin/tc:/usr/libexec/tc-tiny
60 DEPENDS:=+kmod-sched-core +libxtables +tc-mod-iptables +(PACKAGE_devlink||PACKAGE_rdma):libmnl
61 endef
62
63 define Package/tc-full
64 $(call Package/iproute2/Default)
65 TITLE:=Traffic control utility (full)
66 VARIANT:=tcfull
67 PROVIDES:=tc
68 ALTERNATIVES:=300:/sbin/tc:/usr/libexec/tc-full
69 DEPENDS:=+kmod-sched-core +libxtables +tc-mod-iptables +libbpf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
70 endef
71
72 define Package/tc-mod-iptables
73 $(call Package/iproute2/Default)
74 TITLE:=Traffic control module - iptables action
75 DEPENDS:=+libxtables
76 endef
77
78 define Package/genl
79 $(call Package/iproute2/Default)
80 TITLE:=General netlink utility frontend
81 DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
82 endef
83
84 define Package/ip-bridge
85 $(call Package/iproute2/Default)
86 TITLE:=Bridge configuration utility from iproute2
87 DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
88 endef
89
90 define Package/ss
91 $(call Package/iproute2/Default)
92 TITLE:=Socket statistics utility
93 DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +kmod-netlink-diag
94 endef
95
96 define Package/nstat
97 $(call Package/iproute2/Default)
98 TITLE:=Network statistics utility
99 DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
100 endef
101
102 define Package/devlink
103 $(call Package/iproute2/Default)
104 TITLE:=Network devlink utility
105 DEPENDS:=+libmnl
106 endef
107
108 define Package/rdma
109 $(call Package/iproute2/Default)
110 TITLE:=Network rdma utility
111 DEPENDS:=+libmnl
112 endef
113
114 ifeq ($(BUILD_VARIANT),iptiny)
115 IP_CONFIG_TINY:=y
116 LIBBPF_FORCE:=off
117 endif
118
119 ifeq ($(BUILD_VARIANT),ipfull)
120 HAVE_ELF:=y
121 LIBBPF_FORCE:=on
122 endif
123
124 ifeq ($(BUILD_VARIANT),tctiny)
125 LIBBPF_FORCE:=off
126 SHARED_LIBS:=y
127 endif
128
129 ifeq ($(BUILD_VARIANT),tcfull)
130 HAVE_ELF:=y
131 LIBBPF_FORCE:=on
132 SHARED_LIBS:=y
133 endif
134
135 ifdef CONFIG_PACKAGE_devlink
136 HAVE_MNL:=y
137 endif
138
139 ifdef CONFIG_PACKAGE_rdma
140 HAVE_MNL:=y
141 endif
142
143 define Build/Configure
144 echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
145 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
146 endef
147
148 TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
149 TARGET_LDFLAGS += -Wl,--gc-sections -Wl,--as-needed
150 TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
151
152 MAKE_FLAGS += \
153 KERNEL_INCLUDE="$(LINUX_DIR)/user_headers/include" \
154 SHARED_LIBS=$(SHARED_LIBS) \
155 IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
156 BUILD_VARIANT=$(BUILD_VARIANT) \
157 LIBBPF_FORCE=$(LIBBPF_FORCE) \
158 HAVE_ELF=$(HAVE_ELF) \
159 HAVE_MNL=$(HAVE_MNL) \
160 HAVE_CAP=$(HAVE_CAP) \
161 IPT_LIB_DIR=/usr/lib/iptables \
162 XT_LIB_DIR=/usr/lib/iptables \
163 FPIC="$(FPIC)" \
164 $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
165
166 define Build/Compile
167 +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
168 endef
169
170 define Build/InstallDev
171 $(INSTALL_DIR) $(1)/usr/include/iproute2
172 $(CP) $(PKG_BUILD_DIR)/include/bpf_elf.h $(1)/usr/include/iproute2
173 $(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink}.h $(1)/usr/include/
174 $(INSTALL_DIR) $(1)/usr/lib
175 $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
176 endef
177
178 define Package/ip-tiny/install
179 $(INSTALL_DIR) $(1)/usr/libexec
180 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/libexec/ip-tiny
181 endef
182
183 define Package/ip-full/install
184 $(INSTALL_DIR) $(1)/usr/libexec
185 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/libexec/ip-full
186 endef
187
188 define Package/tc-tiny/install
189 $(INSTALL_DIR) $(1)/usr/libexec
190 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-tiny
191 endef
192
193 define Package/tc-full/install
194 $(INSTALL_DIR) $(1)/usr/libexec
195 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/libexec/tc-full
196 endef
197
198 define Package/tc-mod-iptables/install
199 $(INSTALL_DIR) $(1)/usr/lib/tc
200 $(CP) $(PKG_BUILD_DIR)/tc/m_xt.so $(1)/usr/lib/tc
201 endef
202
203 define Package/genl/install
204 $(INSTALL_DIR) $(1)/usr/sbin
205 $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
206 endef
207
208 define Package/ip-bridge/install
209 $(INSTALL_DIR) $(1)/usr/sbin
210 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
211 endef
212
213 define Package/ss/install
214 $(INSTALL_DIR) $(1)/usr/sbin
215 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
216 endef
217
218 define Package/nstat/install
219 $(INSTALL_DIR) $(1)/usr/sbin
220 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/nstat $(1)/usr/sbin/
221 endef
222
223 define Package/devlink/install
224 $(INSTALL_DIR) $(1)/usr/sbin
225 $(INSTALL_BIN) $(PKG_BUILD_DIR)/devlink/devlink $(1)/usr/sbin/
226 endef
227
228 define Package/rdma/install
229 $(INSTALL_DIR) $(1)/usr/sbin
230 $(INSTALL_BIN) $(PKG_BUILD_DIR)/rdma/rdma $(1)/usr/sbin/
231 endef
232
233 $(eval $(call BuildPackage,ip-tiny))
234 $(eval $(call BuildPackage,ip-full))
235 # build tc-mod-iptables before its dependents, to avoid
236 # spurious rebuilds when building multiple variants.
237 $(eval $(call BuildPackage,tc-mod-iptables))
238 $(eval $(call BuildPackage,tc-tiny))
239 $(eval $(call BuildPackage,tc-full))
240 $(eval $(call BuildPackage,genl))
241 $(eval $(call BuildPackage,ip-bridge))
242 $(eval $(call BuildPackage,ss))
243 $(eval $(call BuildPackage,nstat))
244 $(eval $(call BuildPackage,devlink))
245 $(eval $(call BuildPackage,rdma))