]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - contrib/hostapd/Makefile
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / contrib / hostapd / Makefile
1 CC=gcc
2 DIR_WPA_SUPPLICANT=.
3
4 ifndef CFLAGS
5 CFLAGS = -MMD -O2 -Wall -g
6 endif
7
8 # define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to
9 # a file (undefine it, if you want to save in binary size)
10 CFLAGS += -DHOSTAPD_DUMP_STATE
11
12 # Include directories for CVS version
13 CFLAGS += -I. -I../utils -I$(DIR_WPA_SUPPLICANT)
14
15 # Uncomment following line and set the path to your kernel tree include
16 # directory if your C library does not include all header files.
17 # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
18
19 -include .config
20
21 ifndef CONFIG_OS
22 ifdef CONFIG_NATIVE_WINDOWS
23 CONFIG_OS=win32
24 else
25 CONFIG_OS=unix
26 endif
27 endif
28
29 ifeq ($(CONFIG_OS), internal)
30 CFLAGS += -DOS_NO_C_LIB_DEFINES
31 endif
32
33 ifdef CONFIG_NATIVE_WINDOWS
34 CFLAGS += -DCONFIG_NATIVE_WINDOWS
35 LIBS += -lws2_32
36 endif
37
38 OBJS =  hostapd.o eloop.o ieee802_1x.o eapol_sm.o radius.o md5.o rc4.o md4.o \
39         common.o ieee802_11.o config.o ieee802_11_auth.o accounting.o \
40         sta_info.o radius_client.o sha1.o wpa.o aes_wrap.o ctrl_iface.o \
41         driver_conf.o os_$(CONFIG_OS).o preauth.o pmksa_cache.o beacon.o \
42         hw_features.o wme.o ap_list.o reconfig.o \
43         mlme.o vlan_init.o ieee802_11h.o
44
45 HOBJS=hlr_auc_gw.o common.o os_$(CONFIG_OS).o milenage.o aes_wrap.o
46
47 CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX
48
49 ifdef CONFIG_IAPP
50 CFLAGS += -DCONFIG_IAPP
51 OBJS += iapp.o
52 endif
53
54 ifdef CONFIG_RSN_PREAUTH
55 CFLAGS += -DCONFIG_RSN_PREAUTH
56 CONFIG_L2_PACKET=y
57 endif
58
59 ifdef CONFIG_PEERKEY
60 CFLAGS += -DCONFIG_PEERKEY
61 endif
62
63 ifdef CONFIG_IEEE80211W
64 CFLAGS += -DCONFIG_IEEE80211W
65 NEED_SHA256=y
66 endif
67
68 ifdef CONFIG_DRIVER_HOSTAP
69 CFLAGS += -DCONFIG_DRIVER_HOSTAP
70 OBJS += driver.o
71 endif
72
73 ifdef CONFIG_DRIVER_WIRED
74 CFLAGS += -DCONFIG_DRIVER_WIRED
75 OBJS += driver_wired.o
76 endif
77
78 ifdef CONFIG_DRIVER_MADWIFI
79 CFLAGS += -DCONFIG_DRIVER_MADWIFI
80 OBJS += driver_madwifi.o
81 CONFIG_L2_PACKET=y
82 endif
83
84 ifdef CONFIG_DRIVER_PRISM54
85 CFLAGS += -DCONFIG_DRIVER_PRISM54
86 OBJS += driver_prism54.o
87 endif
88
89 ifdef CONFIG_DRIVER_DEVICESCAPE
90 CFLAGS += -DCONFIG_DRIVER_DEVICESCAPE
91 OBJS += driver_devicescape.o
92 endif
93
94 ifdef CONFIG_DRIVER_BSD
95 CFLAGS += -DCONFIG_DRIVER_BSD
96 OBJS += driver_bsd.o
97 CONFIG_L2_PACKET=y
98 CONFIG_DNET_PCAP=y
99 CONFIG_L2_FREEBSD=y
100 endif
101
102 ifdef CONFIG_DRIVER_TEST
103 CFLAGS += -DCONFIG_DRIVER_TEST
104 OBJS += driver_test.o
105 endif
106
107 ifdef CONFIG_L2_PACKET
108 ifdef CONFIG_DNET_PCAP
109 ifdef CONFIG_L2_FREEBSD
110 LIBS += -lpcap
111 OBJS += $(DIR_WPA_SUPPLICANT)/l2_packet_freebsd.o
112 else
113 LIBS += -ldnet -lpcap
114 OBJS += $(DIR_WPA_SUPPLICANT)/l2_packet_pcap.o
115 endif
116 else
117 OBJS += $(DIR_WPA_SUPPLICANT)/l2_packet_linux.o
118 endif
119 endif
120
121
122 ifdef CONFIG_EAP_MD5
123 CFLAGS += -DEAP_MD5
124 OBJS += eap_md5.o
125 endif
126
127 ifdef CONFIG_EAP_TLS
128 CFLAGS += -DEAP_TLS
129 OBJS += eap_tls.o
130 TLS_FUNCS=y
131 endif
132
133 ifdef CONFIG_EAP_PEAP
134 CFLAGS += -DEAP_PEAP
135 OBJS += eap_peap.o
136 TLS_FUNCS=y
137 CONFIG_EAP_TLV=y
138 CONFIG_EAP_MSCHAPV2=y
139 endif
140
141 ifdef CONFIG_EAP_TTLS
142 CFLAGS += -DEAP_TTLS
143 OBJS += eap_ttls.o
144 TLS_FUNCS=y
145 endif
146
147 ifdef CONFIG_EAP_MSCHAPV2
148 CFLAGS += -DEAP_MSCHAPv2
149 OBJS += eap_mschapv2.o
150 MS_FUNCS=y
151 endif
152
153 ifdef CONFIG_EAP_GTC
154 CFLAGS += -DEAP_GTC
155 OBJS += eap_gtc.o
156 endif
157
158 ifdef CONFIG_EAP_SIM
159 CFLAGS += -DEAP_SIM
160 OBJS += eap_sim.o
161 CONFIG_EAP_SIM_COMMON=y
162 endif
163
164 ifdef CONFIG_EAP_AKA
165 CFLAGS += -DEAP_AKA
166 OBJS += eap_aka.o
167 CONFIG_EAP_SIM_COMMON=y
168 endif
169
170 ifdef CONFIG_EAP_SIM_COMMON
171 OBJS += $(DIR_WPA_SUPPLICANT)/eap_sim_common.o
172 # Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
173 # replaced with another file implementating the interface specified in
174 # eap_sim_db.h.
175 OBJS += eap_sim_db.o
176 endif
177
178 ifdef CONFIG_EAP_PAX
179 CFLAGS += -DEAP_PAX
180 OBJS += eap_pax.o $(DIR_WPA_SUPPLICANT)/eap_pax_common.o
181 endif
182
183 ifdef CONFIG_EAP_PSK
184 CFLAGS += -DEAP_PSK
185 OBJS += eap_psk.o $(DIR_WPA_SUPPLICANT)/eap_psk_common.o
186 endif
187
188 ifdef CONFIG_EAP_SAKE
189 CFLAGS += -DEAP_SAKE
190 OBJS += eap_sake.o $(DIR_WPA_SUPPLICANT)/eap_sake_common.o
191 endif
192
193 ifdef CONFIG_EAP_GPSK
194 CFLAGS += -DEAP_GPSK
195 OBJS += eap_gpsk.o $(DIR_WPA_SUPPLICANT)/eap_gpsk_common.o
196 ifdef CONFIG_EAP_GPSK_SHA256
197 CFLAGS += -DEAP_GPSK_SHA256
198 NEED_SHA256=y
199 endif
200 endif
201
202 ifdef CONFIG_EAP_VENDOR_TEST
203 CFLAGS += -DEAP_VENDOR_TEST
204 OBJS += eap_vendor_test.o
205 endif
206
207 ifdef CONFIG_EAP_TLV
208 CFLAGS += -DEAP_TLV
209 OBJS += eap_tlv.o
210 endif
211
212 ifdef CONFIG_EAP
213 CFLAGS += -DEAP_SERVER
214 OBJS += eap.o eap_methods.o eap_identity.o
215 endif
216
217 ifndef CONFIG_TLS
218 CONFIG_TLS=openssl
219 endif
220
221 ifdef TLS_FUNCS
222 # Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
223 CFLAGS += -DEAP_TLS_FUNCS
224 OBJS += eap_tls_common.o
225 ifeq ($(CONFIG_TLS), openssl)
226 OBJS += $(DIR_WPA_SUPPLICANT)/tls_openssl.o
227 LIBS += -lssl -lcrypto
228 LIBS_p += -lcrypto
229 LIBS_h += -lcrypto
230 endif
231 ifeq ($(CONFIG_TLS), gnutls)
232 OBJS += $(DIR_WPA_SUPPLICANT)/tls_gnutls.o
233 LIBS += -lgnutls -lgcrypt -lgpg-error
234 LIBS_p += -lgcrypt
235 LIBS_h += -lgcrypt
236 endif
237 ifdef CONFIG_GNUTLS_EXTRA
238 CFLAGS += -DCONFIG_GNUTLS_EXTRA
239 LIBS += -lgnutls-extra
240 endif
241 NEED_CRYPTO=y
242 else
243 OBJS += $(DIR_WPA_SUPPLICANT)/tls_none.o
244 endif
245
246 ifdef CONFIG_PKCS12
247 CFLAGS += -DPKCS12_FUNCS
248 endif
249
250 ifdef MS_FUNCS
251 OBJS += $(DIR_WPA_SUPPLICANT)/ms_funcs.o
252 NEED_CRYPTO=y
253 endif
254
255 ifdef NEED_CRYPTO
256 ifndef TLS_FUNCS
257 ifeq ($(CONFIG_TLS), openssl)
258 LIBS += -lcrypto
259 LIBS_p += -lcrypto
260 LIBS_h += -lcrypto
261 endif
262 ifeq ($(CONFIG_TLS), gnutls)
263 LIBS += -lgcrypt
264 LIBS_p += -lgcrypt
265 LIBS_h += -lgcrypt
266 endif
267 endif
268 ifeq ($(CONFIG_TLS), openssl)
269 OBJS += $(DIR_WPA_SUPPLICANT)/crypto.o
270 OBJS_p += $(DIR_WPA_SUPPLICANT)/crypto.o
271 HOBJS += $(DIR_WPA_SUPPLICANT)/crypto.o
272 CONFIG_INTERNAL_SHA256=y
273 endif
274 ifeq ($(CONFIG_TLS), gnutls)
275 OBJS += $(DIR_WPA_SUPPLICANT)/crypto_gnutls.o
276 OBJS_p += $(DIR_WPA_SUPPLICANT)/crypto_gnutls.o
277 HOBJS += $(DIR_WPA_SUPPLICANT)/crypto_gnutls.o
278 CONFIG_INTERNAL_SHA256=y
279 endif
280 else
281 CONFIG_INTERNAL_AES=y
282 CONFIG_INTERNAL_SHA1=y
283 CONFIG_INTERNAL_MD5=y
284 CONFIG_INTERNAL_SHA256=y
285 endif
286
287 ifdef CONFIG_INTERNAL_AES
288 CFLAGS += -DINTERNAL_AES
289 endif
290 ifdef CONFIG_INTERNAL_SHA1
291 CFLAGS += -DINTERNAL_SHA1
292 endif
293 ifdef CONFIG_INTERNAL_SHA256
294 CFLAGS += -DINTERNAL_SHA256
295 endif
296 ifdef CONFIG_INTERNAL_MD5
297 CFLAGS += -DINTERNAL_MD5
298 endif
299 ifdef CONFIG_INTERNAL_MD4
300 CFLAGS += -DINTERNAL_MD4
301 endif
302
303 ifdef NEED_SHA256
304 OBJS += sha256.o
305 endif
306
307 ifdef CONFIG_RADIUS_SERVER
308 CFLAGS += -DRADIUS_SERVER
309 OBJS += radius_server.o
310 endif
311
312 ifdef CONFIG_IPV6
313 CFLAGS += -DCONFIG_IPV6
314 endif
315
316 ifdef CONFIG_DRIVER_RADIUS_ACL
317 CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
318 endif
319
320 ifdef CONFIG_FULL_DYNAMIC_VLAN
321 # define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
322 # and vlan interfaces for the vlan feature.
323 CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
324 endif
325
326 ALL=hostapd hostapd_cli
327
328 all: verify_config $(ALL)
329
330 verify_config:
331         @if [ ! -r .config ]; then \
332                 echo 'Building hostapd requires a configuration file'; \
333                 echo '(.config). See README for more instructions. You can'; \
334                 echo 'run "cp defconfig .config" to create an example'; \
335                 echo 'configuration.'; \
336                 exit 1; \
337         fi
338
339 install: all
340         for i in $(ALL); do cp $$i /usr/local/bin/$$i; done
341
342 hostapd: $(OBJS)
343         $(CC) -o hostapd $(OBJS) $(LIBS)
344
345 driver_conf.c: Makefile .config
346         rm -f driver_conf.c
347         echo '/* THIS FILE AUTOMATICALLY GENERATED, DO NOT EDIT! */' \
348                                                         > driver_conf.c
349         echo '#include "includes.h"'                    >> driver_conf.c
350         echo '#include "hostapd.h"'                     >> driver_conf.c
351         echo '#include "driver.h"'                      >> driver_conf.c
352 ifdef CONFIG_DRIVER_HOSTAP
353         echo "void hostap_driver_register(void);"       >> driver_conf.c
354 endif
355 ifdef CONFIG_DRIVER_WIRED
356         echo "void wired_driver_register(void);"        >> driver_conf.c
357 endif
358 ifdef CONFIG_DRIVER_MADWIFI
359         echo "void madwifi_driver_register(void);"      >> driver_conf.c
360 endif
361 ifdef CONFIG_DRIVER_PRISM54
362         echo "void prism54_driver_register(void);"      >> driver_conf.c
363 endif
364 ifdef CONFIG_DRIVER_DEVICESCAPE
365         echo "void devicescape_driver_register(void);"  >> driver_conf.c
366 endif
367 ifdef CONFIG_DRIVER_BSD
368         echo "void bsd_driver_register(void);"          >> driver_conf.c
369 endif
370 ifdef CONFIG_DRIVER_TEST
371         echo "void test_driver_register(void);"         >> driver_conf.c
372 endif
373         echo 'void register_drivers(void) {'            >> driver_conf.c
374 ifdef CONFIG_DRIVER_HOSTAP
375         echo "hostap_driver_register();"                >> driver_conf.c
376 endif
377 ifdef CONFIG_DRIVER_WIRED
378         echo "wired_driver_register();"                 >> driver_conf.c
379 endif
380 ifdef CONFIG_DRIVER_MADWIFI
381         echo "madwifi_driver_register();"               >> driver_conf.c
382 endif
383 ifdef CONFIG_DRIVER_PRISM54
384         echo "prism54_driver_register();"               >> driver_conf.c
385 endif
386 ifdef CONFIG_DRIVER_DEVICESCAPE
387         echo "devicescape_driver_register();"           >> driver_conf.c
388 endif
389 ifdef CONFIG_DRIVER_BSD
390         echo "bsd_driver_register();"                   >> driver_conf.c
391 endif
392 ifdef CONFIG_DRIVER_TEST
393         echo "test_driver_register();"                  >> driver_conf.c
394 endif
395         echo '}'                                        >> driver_conf.c
396
397 hostapd_cli: hostapd_cli.o $(DIR_WPA_SUPPLICANT)/wpa_ctrl.o
398         $(CC) -o hostapd_cli hostapd_cli.o $(DIR_WPA_SUPPLICANT)/wpa_ctrl.o
399
400 NOBJS = nt_password_hash.o $(DIR_WPA_SUPPLICANT)/ms_funcs.o sha1.o rc4.o md5.o
401 NOBJS += $(DIR_WPA_SUPPLICANT)/crypto.o os_$(CONFIG_OS).o
402 ifdef TLS_FUNCS
403 LIBS_n += -lcrypto
404 endif
405
406 nt_password_hash: $(NOBJS)
407         $(CC) -o nt_password_hash $(NOBJS) $(LIBS_n)
408
409 hlr_auc_gw: $(HOBJS)
410         $(CC) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
411
412 clean:
413         rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
414         rm -f *.d driver_conf.c
415
416 %.eps: %.fig
417         fig2dev -L eps $*.fig $*.eps
418
419 %.png: %.fig
420         fig2dev -L png -m 3 $*.fig | pngtopnm | pnmscale 0.4 | pnmtopng \
421                 > $*.png
422
423 docs-pics: doc/hostapd.png doc/hostapd.eps
424
425 docs: docs-pics
426         doxygen doc/doxygen.full
427         $(MAKE) -C doc/latex
428         cp doc/latex/refman.pdf hostapd-devel.pdf
429
430 docs-fast: docs-pics
431         doxygen doc/doxygen.fast
432
433 clean-docs:
434         rm -rf doc/latex doc/html
435         rm -f doc/hosta.d{eps,png} hostapd-devel.pdf
436
437 TEST_SRC_MILENAGE = milenage.c aes_wrap.c common.c os_$(CONFIG_OS).c
438 test-milenage: $(TEST_SRC_MILENAGE)
439         $(CC) -o test-milenage -Wall -Werror $(TEST_SRC_MILENAGE) \
440                 -DTEST_MAIN_MILENAGE -I. -I../wpa_supplicant -DINTERNAL_AES
441         ./test-milenage
442         rm test-milenage
443
444 -include $(OBJS:%.o=%.d)