build: remove obsolete references to cris and avr32
[openwrt/svn-archive/archive.git] / package / network / services / hostapd / Makefile
1 #
2 # Copyright (C) 2006-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:=hostapd
11 PKG_VERSION:=2014-10-25
12 PKG_RELEASE:=1
13 PKG_REV:=01e2231fdc4fbec61fbc382238e3606a1d2826e4
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
17 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
18 PKG_SOURCE_VERSION:=$(PKG_REV)
19 PKG_SOURCE_PROTO:=git
20 # PKG_MIRROR_MD5SUM:=4e7c1f97edd7514535056fce54ae053a
21
22 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
23 PKG_LICENSE:=BSD-3-Clause
24
25 PKG_BUILD_PARALLEL:=1
26
27 PKG_BUILD_DEPENDS:= \
28 PACKAGE_kmod-madwifi:madwifi \
29
30 PKG_CONFIG_DEPENDS:= \
31 CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
32 CONFIG_PACKAGE_kmod-ath9k \
33 CONFIG_PACKAGE_kmod-cfg80211 \
34 CONFIG_PACKAGE_kmod-madwifi \
35 CONFIG_PACKAGE_hostapd \
36 CONFIG_PACKAGE_hostapd-mini \
37 CONFIG_PACKAGE_kmod-hostap \
38 CONFIG_WPA_RFKILL_SUPPORT \
39 CONFIG_DRIVER_WEXT_SUPPORT \
40 CONFIG_DRIVER_11N_SUPPORT
41
42 LOCAL_TYPE=$(strip \
43 $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \
44 $(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
45 hostapd \
46 )))
47 LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
48
49 ifeq ($(LOCAL_TYPE),supplicant)
50 ifeq ($(LOCAL_VARIANT),full)
51 PKG_CONFIG_DEPENDS += \
52 CONFIG_WPA_SUPPLICANT_INTERNAL \
53 CONFIG_WPA_SUPPLICANT_OPENSSL
54 endif
55 endif
56
57 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
58
59 include $(INCLUDE_DIR)/package.mk
60
61 STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(CONFIG_WPA_MSG_MIN_PRIORITY)
62
63 ifneq ($(CONFIG_DRIVER_11N_SUPPORT),)
64 HOSTAPD_IEEE80211N:=y
65 endif
66
67 DRIVER_MAKEOPTS= \
68 CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
69 CONFIG_DRIVER_MADWIFI=$(CONFIG_PACKAGE_kmod-madwifi) \
70 CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
71 CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
72 CONFIG_IEEE80211W=$(CONFIG_PACKAGE_kmod-ath9k) \
73 CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
74
75 ifneq ($(LOCAL_TYPE),hostapd)
76 ifdef CONFIG_WPA_SUPPLICANT_OPENSSL
77 ifeq ($(LOCAL_VARIANT),full)
78 DRIVER_MAKEOPTS += CONFIG_TLS=openssl
79 TARGET_LDFLAGS += -lcrypto -lssl
80 endif
81 endif
82 ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
83 TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK
84 endif
85 ifdef CONFIG_WPA_RFKILL_SUPPORT
86 DRIVER_MAKEOPTS += NEED_RFKILL=y
87 endif
88 DRIVER_MAKEOPTS += \
89 CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch)
90 endif
91
92 ifdef CONFIG_USE_GLIBC
93 TARGET_LDFLAGS += -lrt
94 TARGET_LDFLAGS_C += -lrt
95 endif
96
97 DRV_DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny
98
99 define Package/hostapd/Default
100 SECTION:=net
101 CATEGORY:=Network
102 TITLE:=IEEE 802.1x Authenticator
103 URL:=http://hostap.epitest.fi/
104 DEPENDS:=$(DRV_DEPENDS) +libubus
105 endef
106
107 define Package/hostapd
108 $(call Package/hostapd/Default)
109 TITLE+= (full)
110 VARIANT:=full
111 CONFLICTS:=wpad wpad-mini
112 endef
113
114 define Package/hostapd/description
115 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
116 Authenticator.
117 endef
118
119 define Package/hostapd-mini
120 $(call Package/hostapd/Default)
121 TITLE+= (WPA-PSK only)
122 VARIANT:=mini
123 CONFLICTS:=wpad wpad-mini
124 endef
125
126 define Package/hostapd-mini/description
127 This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
128 endef
129
130 define Package/hostapd-utils
131 $(call Package/hostapd/Default)
132 TITLE+= (utils)
133 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini||PACKAGE_wpad||PACKAGE_wpad-mini
134 endef
135
136 define Package/hostapd-utils/description
137 This package contains a command line utility to control the
138 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
139 endef
140
141 define Package/wpad/Default
142 SECTION:=net
143 CATEGORY:=Network
144 TITLE:=IEEE 802.1x Authenticator/Supplicant
145 URL:=http://hostap.epitest.fi/
146 endef
147
148 define Package/wpad
149 $(call Package/wpad/Default)
150 TITLE+= (full)
151 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl +libubus
152 VARIANT:=wpad-full
153 endef
154
155 define Package/wpad/description
156 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
157 Authenticator and Supplicant
158 endef
159
160 define Package/wpad-mini
161 $(call Package/wpad/Default)
162 TITLE+= (WPA-PSK only)
163 DEPENDS:=$(DRV_DEPENDS) +libubus
164 VARIANT:=wpad-mini
165 endef
166
167 define Package/wpad-mini/description
168 This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
169 endef
170
171 define Package/wpa-supplicant
172 SECTION:=net
173 CATEGORY:=Network
174 TITLE:=WPA Supplicant
175 URL:=http://hostap.epitest.fi/wpa_supplicant/
176 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
177 CONFLICTS:=wpad wpad-mini
178 VARIANT:=supplicant-full
179 endef
180
181 define Package/wpa-supplicant/Description
182 WPA Supplicant
183 endef
184
185 define Package/wpa-supplicant/config
186 source "$(SOURCE)/Config.in"
187 endef
188
189 define Package/wpa-supplicant-p2p
190 $(Package/wpa-supplicant)
191 TITLE:=WPA Supplicant (with Wi-Fi P2P support)
192 DEPENDS:=$(DRV_DEPENDS)
193 CONFLICTS:=wpad wpad-mini
194 VARIANT:=supplicant-p2p
195 endef
196
197 define Package/wpa-supplicant-p2p/Description
198 WPA Supplicant (with Wi-Fi P2P support)
199 endef
200
201 define Package/wpa-supplicant-mini
202 $(Package/wpa-supplicant)
203 TITLE:=WPA Supplicant (minimal version)
204 DEPENDS:=$(DRV_DEPENDS)
205 CONFLICTS:=wpad wpad-mini
206 VARIANT:=supplicant-mini
207 endef
208
209 define Package/wpa-supplicant-mini/Description
210 WPA Supplicant (minimal version)
211 endef
212
213 define Package/wpa-cli
214 SECTION:=net
215 CATEGORY:=Network
216 DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpa-supplicant-p2p||PACKAGE_wpad-mini||PACKAGE_wpad
217 TITLE:=WPA Supplicant command line interface
218 endef
219
220 define Package/wpa-cli/Description
221 WPA Supplicant control utility
222 endef
223
224 define Package/hostapd-common
225 TITLE:=hostapd/wpa_supplicant common support files
226 SECTION:=net
227 CATEGORY:=Network
228 endef
229
230 define Package/hostapd-common-old
231 TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
232 SECTION:=net
233 CATEGORY:=Network
234 endef
235
236 define Package/eapol-test
237 TITLE:=802.1x authentication test utility
238 SECTION:=net
239 CATEGORY:=Network
240 VARIANT:=supplicant-full
241 DEPENDS:=$(DRV_DEPENDS)
242 endef
243
244
245 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
246 define Build/Configure/rebuild
247 $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
248 rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
249 rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
250 rm -f $(PKG_BUILD_DIR)/.config_*
251 touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
252 endef
253 endif
254
255 define Build/Configure
256 $(Build/Configure/rebuild)
257 $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
258 $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
259 )
260 $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
261 endef
262
263 TARGET_CPPFLAGS := \
264 -I$(STAGING_DIR)/usr/include/libnl-tiny \
265 -I$(PKG_BUILD_DIR)/src/crypto \
266 $(TARGET_CPPFLAGS) \
267 -I$(CURDIR)/madwifi \
268 -DCONFIG_LIBNL20 \
269 -D_GNU_SOURCE \
270 $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY))
271
272 TARGET_CFLAGS += -ffunction-sections -fdata-sections
273 TARGET_LDFLAGS += -Wl,--gc-sections
274 ifeq ($(findstring supplicant,$(BUILD_VARIANT)),)
275 TARGET_LDFLAGS += -lubox -lubus
276 endif
277
278 ifdef CONFIG_PACKAGE_kmod-cfg80211
279 TARGET_LDFLAGS += -lm -lnl-tiny
280 endif
281
282 define Build/RunMake
283 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
284 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \
285 $(TARGET_CONFIGURE_OPTS) \
286 $(DRIVER_MAKEOPTS) \
287 LIBS="$(TARGET_LDFLAGS)" \
288 LIBS_c="$(TARGET_LDFLAGS_C)" \
289 BCHECK= \
290 $(2)
291 endef
292
293 define Build/Compile/wpad
294 echo ` \
295 $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
296 $(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
297 sed -e 's,-n ,,g' -e 's^$(TARGET_CFLAGS)^^' \
298 ` > $(PKG_BUILD_DIR)/.cflags
299 +$(call Build/RunMake,hostapd, \
300 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
301 MULTICALL=1 \
302 hostapd_cli hostapd_multi.a \
303 )
304 +$(call Build/RunMake,wpa_supplicant, \
305 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
306 MULTICALL=1 \
307 wpa_cli wpa_supplicant_multi.a \
308 )
309 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
310 $(TARGET_CFLAGS) \
311 ./files/multicall.c \
312 $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
313 $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
314 $(TARGET_LDFLAGS)
315 endef
316
317 define Build/Compile/hostapd
318 $(call Build/RunMake,hostapd, \
319 hostapd hostapd_cli \
320 )
321 endef
322
323 define Build/Compile/supplicant
324 $(call Build/RunMake,wpa_supplicant, \
325 wpa_cli wpa_supplicant \
326 )
327 endef
328
329 define Build/Compile/supplicant-full
330 $(call Build/RunMake,wpa_supplicant, \
331 eapol_test \
332 )
333 endef
334
335 define Build/Compile
336 $(Build/Compile/$(LOCAL_TYPE))
337 $(Build/Compile/$(BUILD_VARIANT))
338 endef
339
340 define Install/hostapd
341 $(INSTALL_DIR) $(1)/usr/sbin
342 endef
343
344 define Install/supplicant
345 $(INSTALL_DIR) $(1)/usr/sbin
346 endef
347
348 define Package/hostapd-common/install
349 $(INSTALL_DIR) $(1)/lib/netifd
350 $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
351 endef
352
353 define Package/hostapd-common-old/install
354 $(INSTALL_DIR) $(1)/lib/wifi
355 $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
356 $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
357 endef
358
359 define Package/hostapd/install
360 $(call Install/hostapd,$(1))
361 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
362 endef
363 Package/hostapd-mini/install = $(Package/hostapd/install)
364
365 ifneq ($(LOCAL_TYPE),supplicant)
366 define Package/hostapd-utils/install
367 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/rc.button
368 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
369 $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
370 endef
371 endif
372
373 define Package/wpad/install
374 $(call Install/hostapd,$(1))
375 $(call Install/supplicant,$(1))
376 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
377 $(LN) wpad $(1)/usr/sbin/hostapd
378 $(LN) wpad $(1)/usr/sbin/wpa_supplicant
379 endef
380 Package/wpad-mini/install = $(Package/wpad/install)
381
382 define Package/wpa-supplicant/install
383 $(call Install/supplicant,$(1))
384 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
385 endef
386 Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
387 Package/wpa-supplicant-p2p/install = $(Package/wpa-supplicant/install)
388
389 ifneq ($(LOCAL_TYPE),hostapd)
390 define Package/wpa-cli/install
391 $(INSTALL_DIR) $(1)/usr/sbin
392 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
393 endef
394 endif
395
396 ifeq ($(BUILD_VARIANT),supplicant-full)
397 define Package/eapol-test/install
398 $(INSTALL_DIR) $(1)/usr/sbin
399 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/
400 endef
401 endif
402
403 $(eval $(call BuildPackage,hostapd))
404 $(eval $(call BuildPackage,hostapd-mini))
405 $(eval $(call BuildPackage,wpad))
406 $(eval $(call BuildPackage,wpad-mini))
407 $(eval $(call BuildPackage,wpa-supplicant))
408 $(eval $(call BuildPackage,wpa-supplicant-mini))
409 $(eval $(call BuildPackage,wpa-supplicant-p2p))
410 $(eval $(call BuildPackage,wpa-cli))
411 $(eval $(call BuildPackage,hostapd-utils))
412 $(eval $(call BuildPackage,hostapd-common))
413 $(eval $(call BuildPackage,hostapd-common-old))
414 $(eval $(call BuildPackage,eapol-test))