batctl: Add support for hop_penalty settings command
[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.0
13 PKG_RELEASE:=2
14 PKG_HASH:=997721096ff396644e8d697ea7651e9d38243faf317bcea2661d4139ff58b531
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-tiny
34 $(call Package/batctl/Default)
35 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Minimal)
36 VARIANT:=tiny
37 PROVIDES:=batctl
38 ALTERNATIVES:=100:/usr/sbin/batctl:/usr/libexec/batctl-tiny
39 endef
40
41 define Package/batctl-default
42 $(call Package/batctl/Default)
43 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Default)
44 VARIANT:=default
45 ALTERNATIVES:=200:/usr/sbin/batctl:/usr/libexec/batctl-default
46 endef
47
48 define Package/batctl-full
49 $(call Package/batctl/Default)
50 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Full)
51 VARIANT:=full
52 ALTERNATIVES:=300:/usr/sbin/batctl:/usr/libexec/batctl-full
53 endef
54
55 define Package/batctl/description
56 batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced.
57 It is an easier method for configuring batman-adv and provides some
58 additional tools for debugging as well. This package builds
59 version $(PKG_VERSION) of the user space utility.
60 endef
61
62 # The linker can identify unused sections of a binary when each symbol is stored
63 # in a separate section. This mostly removes unused linker sections and reduces
64 # the size by ~3% on mipsel.
65
66 TARGET_CFLAGS += -ffunction-sections -fdata-sections
67 TARGET_LDFLAGS += -Wl,--gc-sections
68
69 # Link-time optimization allows to move parts of the optimization from the single
70 # source file to the global source view. This is done by emitting the GIMPLE
71 # representation in each object file and analyzing it again during the link step.
72
73 TARGET_CFLAGS += -flto
74 TARGET_LDFLAGS += -fuse-linker-plugin
75
76 MAKE_BATCTL_ENV += \
77 CPPFLAGS="$(TARGET_CPPFLAGS)" \
78 CFLAGS="$(TARGET_CFLAGS)" \
79 LDFLAGS="$(TARGET_LDFLAGS)" \
80 LIBNL_NAME="libnl-tiny" \
81 LIBNL_GENL_NAME="libnl-tiny"
82
83 MAKE_BATCTL_ARGS += \
84 REVISION="$(PKG_BATCTL_SHORTREV)" \
85 CC="$(TARGET_CC)" \
86 DESTDIR="$(PKG_INSTALL_DIR)" \
87 batctl install \
88 REVISION="openwrt-$(PKG_VERSION)-$(PKG_RELEASE)"
89
90 config-n := \
91 aggregation \
92 ap_isolation \
93 backbonetable \
94 bisect_iv \
95 bonding \
96 bridge_loop_avoidance \
97 claimtable \
98 dat_cache \
99 distributed_arp_table \
100 event \
101 fragmentation \
102 gateways \
103 gw_mode \
104 hop_penalty \
105 interface \
106 isolation_mark \
107 log \
108 loglevel \
109 mcast_flags \
110 multicast_mode \
111 nc_nodes \
112 neighbors \
113 network_coding \
114 orig_interval \
115 originators \
116 ping \
117 routing_algo \
118 statistics \
119 tcpdump \
120 throughputmeter \
121 traceroute \
122 transglobal \
123 translate \
124 translocal \
125
126 config-settings := \
127 aggregation \
128 ap_isolation \
129 bonding \
130 bridge_loop_avoidance \
131 distributed_arp_table \
132 fragmentation \
133 gw_mode \
134 hop_penalty \
135 interface \
136 isolation_mark \
137 loglevel \
138 multicast_mode \
139 network_coding \
140 orig_interval \
141 routing_algo \
142
143 config-tables := \
144 backbonetable \
145 claimtable \
146 dat_cache \
147 gateways \
148 loglevel \
149 nc_nodes \
150 neighbors \
151 originators \
152 statistics \
153 transglobal \
154 translocal \
155
156 config-tools := \
157 event \
158 log \
159 ping \
160 tcpdump \
161 throughputmeter \
162 traceroute \
163 translate \
164
165 config-extratools := \
166 bisect_iv \
167
168 ifeq ($(BUILD_VARIANT),tiny)
169
170 config-y := \
171 $(config-settings) \
172
173 endif
174
175 ifeq ($(BUILD_VARIANT),default)
176
177 config-y := \
178 $(config-settings) \
179 $(config-tables) \
180 $(config-tools) \
181
182 endif
183
184 ifeq ($(BUILD_VARIANT),full)
185
186 config-y := \
187 $(config-settings) \
188 $(config-tables) \
189 $(config-tools) \
190 $(config-extratools) \
191
192 endif
193
194 define ConfigVars
195 $(subst $(space),,$(foreach opt,$(config-$(1)),CONFIG_$(opt)=$(1)
196 ))
197 endef
198
199 define batctl_config
200 $(call ConfigVars,n)$(call ConfigVars,y)
201 endef
202 $(eval $(call shexport,batctl_config))
203
204 define Build/Compile
205 $(MAKE_BATCTL_ENV) $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATCTL_ARGS) \
206 $$$$$(call shvar,batctl_config)
207 endef
208
209 define Package/batctl-tiny/install
210 $(INSTALL_DIR) $(1)/usr/libexec
211 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-tiny
212 endef
213
214 define Package/batctl-default/install
215 $(INSTALL_DIR) $(1)/usr/libexec
216 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-default
217 endef
218
219 define Package/batctl-full/install
220 $(INSTALL_DIR) $(1)/usr/libexec
221 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-full
222 endef
223
224 $(eval $(call BuildPackage,batctl-default))
225 $(eval $(call BuildPackage,batctl-tiny))
226 $(eval $(call BuildPackage,batctl-full))