5b1d86580e90aedab077a40d7364c71ebc60f2dd
[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.1
13 PKG_RELEASE:=0
14 PKG_HASH:=e82d05f058d8b799d17ce6063e1bf5b83ef1fe42a0867b3e2e39545177469793
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_BATCTL_ENV += \
92 CPPFLAGS="$(TARGET_CPPFLAGS)" \
93 CFLAGS="$(TARGET_CFLAGS)" \
94 LDFLAGS="$(TARGET_LDFLAGS)" \
95 LIBNL_NAME="libnl-tiny" \
96 LIBNL_GENL_NAME="libnl-tiny"
97
98 MAKE_BATCTL_ARGS += \
99 REVISION="$(PKG_BATCTL_SHORTREV)" \
100 CC="$(TARGET_CC)" \
101 DESTDIR="$(PKG_INSTALL_DIR)" \
102 batctl install \
103 REVISION="openwrt-$(PKG_VERSION)-$(PKG_RELEASE)"
104
105 config-n := \
106 aggregation \
107 ap_isolation \
108 backbonetable \
109 bisect_iv \
110 bonding \
111 bridge_loop_avoidance \
112 claimtable \
113 dat_cache \
114 distributed_arp_table \
115 event \
116 fragmentation \
117 gateways \
118 gw_mode \
119 hop_penalty \
120 interface \
121 isolation_mark \
122 log \
123 loglevel \
124 mcast_flags \
125 multicast_forceflood \
126 multicast_mode \
127 nc_nodes \
128 neighbors \
129 network_coding \
130 orig_interval \
131 originators \
132 ping \
133 routing_algo \
134 statistics \
135 tcpdump \
136 throughputmeter \
137 traceroute \
138 transglobal \
139 translate \
140 translocal \
141
142 config-settings := \
143 aggregation \
144 ap_isolation \
145 bonding \
146 bridge_loop_avoidance \
147 distributed_arp_table \
148 fragmentation \
149 gw_mode \
150 hop_penalty \
151 interface \
152 isolation_mark \
153 loglevel \
154 multicast_forceflood \
155 multicast_mode \
156 network_coding \
157 orig_interval \
158 routing_algo \
159
160 config-tables := \
161 backbonetable \
162 claimtable \
163 dat_cache \
164 gateways \
165 loglevel \
166 nc_nodes \
167 neighbors \
168 originators \
169 statistics \
170 transglobal \
171 translocal \
172
173 config-tools := \
174 event \
175 log \
176 ping \
177 tcpdump \
178 throughputmeter \
179 traceroute \
180 translate \
181
182 config-extratools := \
183 bisect_iv \
184
185 ifeq ($(BUILD_VARIANT),tiny)
186
187 config-y := \
188 $(config-settings) \
189
190 endif
191
192 ifeq ($(BUILD_VARIANT),default)
193
194 config-y := \
195 $(config-settings) \
196 $(config-tables) \
197 $(config-tools) \
198
199 endif
200
201 ifeq ($(BUILD_VARIANT),full)
202
203 config-y := \
204 $(config-settings) \
205 $(config-tables) \
206 $(config-tools) \
207 $(config-extratools) \
208
209 endif
210
211 define ConfigVars
212 $(subst $(space),,$(foreach opt,$(config-$(1)),CONFIG_$(opt)=$(1)
213 ))
214 endef
215
216 define batctl_config
217 $(call ConfigVars,n)$(call ConfigVars,y)
218 endef
219 $(eval $(call shexport,batctl_config))
220
221 define Build/Compile
222 $(MAKE_BATCTL_ENV) $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATCTL_ARGS) \
223 $$$$$(call shvar,batctl_config)
224 endef
225
226 define Package/batctl-tiny/install
227 $(INSTALL_DIR) $(1)/usr/libexec
228 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-tiny
229 endef
230
231 define Package/batctl-default/install
232 $(INSTALL_DIR) $(1)/usr/libexec
233 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-default
234 endef
235
236 define Package/batctl-full/install
237 $(INSTALL_DIR) $(1)/usr/libexec
238 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-full
239 endef
240
241 $(eval $(call BuildPackage,batctl-default))
242 $(eval $(call BuildPackage,batctl-tiny))
243 $(eval $(call BuildPackage,batctl-full))