Merge pull request #495 from ecsv/batadv-2019.3
[feed/routing.git] / batctl / Makefile
1 #
2 # Copyright (C) 2014 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:=batctl
11
12 PKG_VERSION:=2019.3
13 PKG_RELEASE:=0
14 PKG_HASH:=2bd93fa14925a8dc63a67e64266c8ccd2fa3ac44b10253d93e6f8a630350070c
15
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
18 PKG_LICENSE:=GPL-2.0
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/batctl/Default
25 URL:=https://www.open-mesh.org/
26 SECTION:=net
27 CATEGORY:=Network
28 DEPENDS:=+libnl-tiny +libc +librt
29 PROVIDES:=batctl
30 MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
31 endef
32
33 define Package/batctl/description
34 batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced.
35 It is an easier method for configuring batman-adv and provides some
36 additional tools for debugging as well. This package builds
37 version $(PKG_VERSION) of the user space utility.
38 endef
39
40 define Package/batctl-tiny
41 $(call Package/batctl/Default)
42 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Minimal)
43 VARIANT:=tiny
44 PROVIDES:=batctl
45 ALTERNATIVES:=100:/usr/sbin/batctl:/usr/libexec/batctl-tiny
46 endef
47
48 define Package/batctl-tiny/description
49 $(Package/batctl/description)
50 Only configuration relevant subcommands are enabled.
51 endef
52
53 define Package/batctl-default
54 $(call Package/batctl/Default)
55 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Default)
56 VARIANT:=default
57 ALTERNATIVES:=200:/usr/sbin/batctl:/usr/libexec/batctl-default
58 endef
59
60 define Package/batctl-default/description
61 $(Package/batctl/description)
62 Standard subcommands for configuration and online debugging are enabled.
63 endef
64
65 define Package/batctl-full
66 $(call Package/batctl/Default)
67 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Full)
68 VARIANT:=full
69 ALTERNATIVES:=300:/usr/sbin/batctl:/usr/libexec/batctl-full
70 endef
71
72 define Package/batctl-full/description
73 $(Package/batctl/description)
74 Subcommands for configuration, online and offline debugging are enabled.
75 endef
76
77 # The linker can identify unused sections of a binary when each symbol is stored
78 # in a separate section. This mostly removes unused linker sections and reduces
79 # the size by ~3% on mipsel.
80
81 TARGET_CFLAGS += -ffunction-sections -fdata-sections
82 TARGET_LDFLAGS += -Wl,--gc-sections
83
84 # Link-time optimization allows to move parts of the optimization from the single
85 # source file to the global source view. This is done by emitting the GIMPLE
86 # representation in each object file and analyzing it again during the link step.
87
88 TARGET_CFLAGS += -flto
89 TARGET_LDFLAGS += -fuse-linker-plugin
90
91 MAKE_VARS += \
92 LIBNL_NAME="libnl-tiny" \
93 LIBNL_GENL_NAME="libnl-tiny"
94
95 MAKE_FLAGS += \
96 REVISION="openwrt-$(PKG_VERSION)-$(PKG_RELEASE)"
97
98 config-n := \
99 aggregation \
100 ap_isolation \
101 backbonetable \
102 bisect_iv \
103 bonding \
104 bridge_loop_avoidance \
105 claimtable \
106 dat_cache \
107 distributed_arp_table \
108 elp_interval \
109 event \
110 fragmentation \
111 gateways \
112 gw_mode \
113 hop_penalty \
114 interface \
115 isolation_mark \
116 loglevel \
117 mcast_flags \
118 multicast_fanout \
119 multicast_forceflood \
120 multicast_mode \
121 nc_nodes \
122 neighbors \
123 network_coding \
124 orig_interval \
125 originators \
126 ping \
127 routing_algo \
128 statistics \
129 tcpdump \
130 throughput_override \
131 throughputmeter \
132 traceroute \
133 transglobal \
134 translate \
135 translocal \
136
137 config-settings := \
138 aggregation \
139 ap_isolation \
140 bonding \
141 bridge_loop_avoidance \
142 distributed_arp_table \
143 elp_interval \
144 fragmentation \
145 gw_mode \
146 hop_penalty \
147 interface \
148 isolation_mark \
149 loglevel \
150 multicast_fanout \
151 multicast_forceflood \
152 multicast_mode \
153 network_coding \
154 orig_interval \
155 routing_algo \
156 throughput_override \
157
158 config-tables := \
159 backbonetable \
160 claimtable \
161 dat_cache \
162 gateways \
163 loglevel \
164 nc_nodes \
165 neighbors \
166 originators \
167 statistics \
168 transglobal \
169 translocal \
170
171 config-tools := \
172 event \
173 ping \
174 tcpdump \
175 throughputmeter \
176 traceroute \
177 translate \
178
179 config-extratools := \
180 bisect_iv \
181
182 ifeq ($(BUILD_VARIANT),tiny)
183
184 config-y := \
185 $(config-settings) \
186
187 endif
188
189 ifeq ($(BUILD_VARIANT),default)
190
191 config-y := \
192 $(config-settings) \
193 $(config-tables) \
194 $(config-tools) \
195
196 endif
197
198 ifeq ($(BUILD_VARIANT),full)
199
200 config-y := \
201 $(config-settings) \
202 $(config-tables) \
203 $(config-tools) \
204 $(config-extratools) \
205
206 endif
207
208 define ConfigVars
209 $(subst $(space),,$(foreach opt,$(config-$(1)),CONFIG_$(opt)=$(1)
210 ))
211 endef
212
213 define batctl_config
214 $(call ConfigVars,n)$(call ConfigVars,y)
215 endef
216 $(eval $(call shexport,batctl_config))
217
218 MAKE_FLAGS += $$$$$(call shvar,batctl_config)
219
220 define Package/batctl-tiny/install
221 $(INSTALL_DIR) $(1)/usr/libexec
222 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-tiny
223 endef
224
225 define Package/batctl-default/install
226 $(INSTALL_DIR) $(1)/usr/libexec
227 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-default
228 endef
229
230 define Package/batctl-full/install
231 $(INSTALL_DIR) $(1)/usr/libexec
232 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-full
233 endef
234
235 $(eval $(call BuildPackage,batctl-default))
236 $(eval $(call BuildPackage,batctl-tiny))
237 $(eval $(call BuildPackage,batctl-full))