Added a new driver wrapper, "none", for RADIUS server only configuration
[libeap.git] / hostapd / Makefile
1 ifndef CC
2 CC=gcc
3 endif
4
5 ifndef CFLAGS
6 CFLAGS = -MMD -O2 -Wall -g
7 endif
8
9 # define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to
10 # a file (undefine it, if you want to save in binary size)
11 CFLAGS += -DHOSTAPD_DUMP_STATE
12
13 CFLAGS += -I../src
14 CFLAGS += -I../src/crypto
15 CFLAGS += -I../src/utils
16 CFLAGS += -I../src/common
17
18 # Uncomment following line and set the path to your kernel tree include
19 # directory if your C library does not include all header files.
20 # CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
21
22 -include .config
23
24 ifndef CONFIG_OS
25 ifdef CONFIG_NATIVE_WINDOWS
26 CONFIG_OS=win32
27 else
28 CONFIG_OS=unix
29 endif
30 endif
31
32 ifeq ($(CONFIG_OS), internal)
33 CFLAGS += -DOS_NO_C_LIB_DEFINES
34 endif
35
36 ifdef CONFIG_NATIVE_WINDOWS
37 CFLAGS += -DCONFIG_NATIVE_WINDOWS
38 LIBS += -lws2_32
39 endif
40
41 OBJS =  hostapd.o ieee802_1x.o eapol_sm.o \
42         ieee802_11.o config.o ieee802_11_auth.o accounting.o \
43         sta_info.o wpa.o ctrl_iface.o \
44         drivers.o preauth.o pmksa_cache.o beacon.o \
45         hw_features.o wme.o ap_list.o reconfig.o \
46         mlme.o vlan_init.o ieee802_11h.o wpa_auth_ie.o
47
48 OBJS += ../src/utils/eloop.o
49 OBJS += ../src/utils/common.o
50 OBJS += ../src/utils/wpa_debug.o
51 OBJS += ../src/utils/wpabuf.o
52 OBJS += ../src/utils/os_$(CONFIG_OS).o
53 OBJS += ../src/utils/ip_addr.o
54
55 OBJS += ../src/common/wpa_common.o
56
57 OBJS += ../src/radius/radius.o
58 OBJS += ../src/radius/radius_client.o
59
60 OBJS += ../src/crypto/md5.o
61 OBJS += ../src/crypto/rc4.o
62 OBJS += ../src/crypto/md4.o
63 OBJS += ../src/crypto/sha1.o
64 OBJS += ../src/crypto/des.o
65 OBJS += ../src/crypto/aes_wrap.o
66 OBJS += ../src/crypto/aes.o
67
68 HOBJS=../src/hlr_auc_gw/hlr_auc_gw.o ../src/utils/common.o ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).o ../src/hlr_auc_gw/milenage.o ../src/crypto/aes_wrap.o ../src/crypto/aes.o
69
70 CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX
71
72 ifdef CONFIG_IAPP
73 CFLAGS += -DCONFIG_IAPP
74 OBJS += iapp.o
75 endif
76
77 ifdef CONFIG_RSN_PREAUTH
78 CFLAGS += -DCONFIG_RSN_PREAUTH
79 CONFIG_L2_PACKET=y
80 endif
81
82 ifdef CONFIG_PEERKEY
83 CFLAGS += -DCONFIG_PEERKEY
84 OBJS += peerkey.o
85 endif
86
87 ifdef CONFIG_IEEE80211W
88 CFLAGS += -DCONFIG_IEEE80211W
89 NEED_SHA256=y
90 endif
91
92 ifdef CONFIG_IEEE80211R
93 CFLAGS += -DCONFIG_IEEE80211R
94 OBJS += wpa_ft.o
95 NEED_SHA256=y
96 endif
97
98 ifdef CONFIG_IEEE80211N
99 CFLAGS += -DCONFIG_IEEE80211N
100 endif
101
102 ifdef CONFIG_DRIVER_HOSTAP
103 CFLAGS += -DCONFIG_DRIVER_HOSTAP
104 OBJS += driver_hostap.o
105 endif
106
107 ifdef CONFIG_DRIVER_WIRED
108 CFLAGS += -DCONFIG_DRIVER_WIRED
109 OBJS += driver_wired.o
110 endif
111
112 ifdef CONFIG_DRIVER_MADWIFI
113 CFLAGS += -DCONFIG_DRIVER_MADWIFI
114 OBJS += driver_madwifi.o
115 CONFIG_L2_PACKET=y
116 endif
117
118 ifdef CONFIG_DRIVER_PRISM54
119 CFLAGS += -DCONFIG_DRIVER_PRISM54
120 OBJS += driver_prism54.o
121 endif
122
123 ifdef CONFIG_DRIVER_NL80211
124 CFLAGS += -DCONFIG_DRIVER_NL80211
125 OBJS += driver_nl80211.o radiotap.o
126 LIBS += -lnl
127 endif
128
129 ifdef CONFIG_DRIVER_BSD
130 CFLAGS += -DCONFIG_DRIVER_BSD
131 OBJS += driver_bsd.o
132 CONFIG_L2_PACKET=y
133 CONFIG_DNET_PCAP=y
134 CONFIG_L2_FREEBSD=y
135 endif
136
137 ifdef CONFIG_DRIVER_TEST
138 CFLAGS += -DCONFIG_DRIVER_TEST
139 OBJS += driver_test.o
140 endif
141
142 ifdef CONFIG_DRIVER_NONE
143 CFLAGS += -DCONFIG_DRIVER_NONE
144 OBJS += driver_none.o
145 endif
146
147 ifdef CONFIG_L2_PACKET
148 ifdef CONFIG_DNET_PCAP
149 ifdef CONFIG_L2_FREEBSD
150 LIBS += -lpcap
151 OBJS += ../src/l2_packet/l2_packet_freebsd.o
152 else
153 LIBS += -ldnet -lpcap
154 OBJS += ../src/l2_packet/l2_packet_pcap.o
155 endif
156 else
157 OBJS += ../src/l2_packet/l2_packet_linux.o
158 endif
159 endif
160
161
162 ifdef CONFIG_EAP_MD5
163 CFLAGS += -DEAP_MD5
164 OBJS += ../src/eap_server/eap_md5.o
165 CHAP=y
166 endif
167
168 ifdef CONFIG_EAP_TLS
169 CFLAGS += -DEAP_TLS
170 OBJS += ../src/eap_server/eap_tls.o
171 TLS_FUNCS=y
172 endif
173
174 ifdef CONFIG_EAP_PEAP
175 CFLAGS += -DEAP_PEAP
176 OBJS += ../src/eap_server/eap_peap.o
177 OBJS += ../src/eap_common/eap_peap_common.o
178 TLS_FUNCS=y
179 CONFIG_EAP_MSCHAPV2=y
180 endif
181
182 ifdef CONFIG_EAP_TTLS
183 CFLAGS += -DEAP_TTLS
184 OBJS += ../src/eap_server/eap_ttls.o
185 TLS_FUNCS=y
186 CHAP=y
187 endif
188
189 ifdef CONFIG_EAP_MSCHAPV2
190 CFLAGS += -DEAP_MSCHAPv2
191 OBJS += ../src/eap_server/eap_mschapv2.o
192 MS_FUNCS=y
193 endif
194
195 ifdef CONFIG_EAP_GTC
196 CFLAGS += -DEAP_GTC
197 OBJS += ../src/eap_server/eap_gtc.o
198 endif
199
200 ifdef CONFIG_EAP_SIM
201 CFLAGS += -DEAP_SIM
202 OBJS += ../src/eap_server/eap_sim.o
203 CONFIG_EAP_SIM_COMMON=y
204 endif
205
206 ifdef CONFIG_EAP_AKA
207 CFLAGS += -DEAP_AKA
208 OBJS += ../src/eap_server/eap_aka.o
209 CONFIG_EAP_SIM_COMMON=y
210 endif
211
212 ifdef CONFIG_EAP_SIM_COMMON
213 OBJS += ../src/eap_common/eap_sim_common.o
214 # Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
215 # replaced with another file implementating the interface specified in
216 # eap_sim_db.h.
217 OBJS += ../src/eap_server/eap_sim_db.o
218 NEED_FIPS186_2_PRF=y
219 endif
220
221 ifdef CONFIG_EAP_PAX
222 CFLAGS += -DEAP_PAX
223 OBJS += ../src/eap_server/eap_pax.o ../src/eap_common/eap_pax_common.o
224 endif
225
226 ifdef CONFIG_EAP_PSK
227 CFLAGS += -DEAP_PSK
228 OBJS += ../src/eap_server/eap_psk.o ../src/eap_common/eap_psk_common.o
229 endif
230
231 ifdef CONFIG_EAP_SAKE
232 CFLAGS += -DEAP_SAKE
233 OBJS += ../src/eap_server/eap_sake.o ../src/eap_common/eap_sake_common.o
234 endif
235
236 ifdef CONFIG_EAP_GPSK
237 CFLAGS += -DEAP_GPSK
238 OBJS += ../src/eap_server/eap_gpsk.o ../src/eap_common/eap_gpsk_common.o
239 ifdef CONFIG_EAP_GPSK_SHA256
240 CFLAGS += -DEAP_GPSK_SHA256
241 endif
242 NEED_SHA256=y
243 endif
244
245 ifdef CONFIG_EAP_VENDOR_TEST
246 CFLAGS += -DEAP_VENDOR_TEST
247 OBJS += ../src/eap_server/eap_vendor_test.o
248 endif
249
250 ifdef CONFIG_EAP_FAST
251 CFLAGS += -DEAP_FAST
252 OBJS += ../src/eap_server/eap_fast.o
253 OBJS += ../src/eap_common/eap_fast_common.o
254 TLS_FUNCS=y
255 NEED_T_PRF=y
256 endif
257
258 ifdef CONFIG_EAP_IKEV2
259 CFLAGS += -DEAP_IKEV2
260 OBJS += ../src/eap_server/eap_ikev2.o ../src/eap_server/ikev2.o
261 OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
262 NEED_DH_GROUPS=y
263 endif
264
265 ifdef CONFIG_EAP_TNC
266 CFLAGS += -DEAP_TNC
267 OBJS += ../src/eap_server/eap_tnc.o
268 OBJS += ../src/eap_server/tncs.o
269 NEED_BASE64=y
270 endif
271
272 # Basic EAP functionality is needed for EAPOL
273 OBJS += ../src/eap_server/eap.o
274 OBJS += ../src/eap_common/eap_common.o
275 OBJS += ../src/eap_server/eap_methods.o
276 OBJS += ../src/eap_server/eap_identity.o
277
278 ifdef CONFIG_EAP
279 CFLAGS += -DEAP_SERVER
280 endif
281
282 ifndef CONFIG_TLS
283 CONFIG_TLS=openssl
284 endif
285
286 ifeq ($(CONFIG_TLS), internal)
287 ifndef CONFIG_CRYPTO
288 CONFIG_CRYPTO=internal
289 endif
290 endif
291 ifeq ($(CONFIG_CRYPTO), libtomcrypt)
292 CFLAGS += -DCONFIG_INTERNAL_X509
293 endif
294 ifeq ($(CONFIG_CRYPTO), internal)
295 CFLAGS += -DCONFIG_INTERNAL_X509
296 endif
297
298
299 ifdef TLS_FUNCS
300 # Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
301 CFLAGS += -DEAP_TLS_FUNCS
302 OBJS += ../src/eap_server/eap_tls_common.o
303 ifeq ($(CONFIG_TLS), openssl)
304 OBJS += ../src/crypto/tls_openssl.o
305 LIBS += -lssl -lcrypto
306 LIBS_p += -lcrypto
307 LIBS_h += -lcrypto
308 endif
309 ifeq ($(CONFIG_TLS), gnutls)
310 OBJS += ../src/crypto/tls_gnutls.o
311 LIBS += -lgnutls -lgcrypt -lgpg-error
312 LIBS_p += -lgcrypt
313 LIBS_h += -lgcrypt
314 endif
315 ifdef CONFIG_GNUTLS_EXTRA
316 CFLAGS += -DCONFIG_GNUTLS_EXTRA
317 LIBS += -lgnutls-extra
318 endif
319 ifeq ($(CONFIG_TLS), internal)
320 OBJS += ../src/crypto/tls_internal.o
321 OBJS += ../src/tls/tlsv1_common.o ../src/tls/tlsv1_record.o
322 OBJS += ../src/tls/tlsv1_cred.o ../src/tls/tlsv1_server.o
323 OBJS += ../src/tls/tlsv1_server_write.o ../src/tls/tlsv1_server_read.o
324 OBJS += ../src/tls/asn1.o ../src/tls/x509v3.o
325 OBJS_p += ../src/tls/asn1.o
326 OBJS_p += ../src/crypto/rc4.o ../src/crypto/aes_wrap.o ../src/crypto/aes.o
327 NEED_BASE64=y
328 CFLAGS += -DCONFIG_TLS_INTERNAL
329 CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
330 ifeq ($(CONFIG_CRYPTO), internal)
331 ifdef CONFIG_INTERNAL_LIBTOMMATH
332 CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
333 else
334 LIBS += -ltommath
335 LIBS_p += -ltommath
336 endif
337 endif
338 ifeq ($(CONFIG_CRYPTO), libtomcrypt)
339 LIBS += -ltomcrypt -ltfm
340 LIBS_p += -ltomcrypt -ltfm
341 endif
342 endif
343 NEED_CRYPTO=y
344 else
345 OBJS += ../src/crypto/tls_none.o
346 endif
347
348 ifdef CONFIG_PKCS12
349 CFLAGS += -DPKCS12_FUNCS
350 endif
351
352 ifdef MS_FUNCS
353 OBJS += ../src/crypto/ms_funcs.o
354 NEED_CRYPTO=y
355 endif
356
357 ifdef CHAP
358 OBJS += ../src/eap_common/chap.o
359 endif
360
361 ifdef NEED_CRYPTO
362 ifndef TLS_FUNCS
363 ifeq ($(CONFIG_TLS), openssl)
364 LIBS += -lcrypto
365 LIBS_p += -lcrypto
366 LIBS_h += -lcrypto
367 endif
368 ifeq ($(CONFIG_TLS), gnutls)
369 LIBS += -lgcrypt
370 LIBS_p += -lgcrypt
371 LIBS_h += -lgcrypt
372 endif
373 ifeq ($(CONFIG_TLS), internal)
374 ifeq ($(CONFIG_CRYPTO), libtomcrypt)
375 LIBS += -ltomcrypt -ltfm
376 LIBS_p += -ltomcrypt -ltfm
377 endif
378 endif
379 endif
380 ifeq ($(CONFIG_TLS), openssl)
381 OBJS += ../src/crypto/crypto_openssl.o
382 OBJS_p += ../src/crypto/crypto_openssl.o
383 HOBJS += ../src/crypto/crypto_openssl.o
384 CONFIG_INTERNAL_SHA256=y
385 endif
386 ifeq ($(CONFIG_TLS), gnutls)
387 OBJS += ../src/crypto/crypto_gnutls.o
388 OBJS_p += ../src/crypto/crypto_gnutls.o
389 HOBJS += ../src/crypto/crypto_gnutls.o
390 CONFIG_INTERNAL_SHA256=y
391 endif
392 ifeq ($(CONFIG_TLS), internal)
393 ifeq ($(CONFIG_CRYPTO), libtomcrypt)
394 OBJS += ../src/crypto/crypto_libtomcrypt.o
395 OBJS_p += ../src/crypto/crypto_libtomcrypt.o
396 CONFIG_INTERNAL_SHA256=y
397 endif
398 ifeq ($(CONFIG_CRYPTO), internal)
399 OBJS += ../src/crypto/crypto_internal.o ../src/tls/rsa.o ../src/tls/bignum.o
400 OBJS_p += ../src/crypto/crypto_internal.o ../src/tls/rsa.o ../src/tls/bignum.o
401 CFLAGS += -DCONFIG_CRYPTO_INTERNAL
402 CONFIG_INTERNAL_AES=y
403 CONFIG_INTERNAL_DES=y
404 CONFIG_INTERNAL_SHA1=y
405 CONFIG_INTERNAL_MD4=y
406 CONFIG_INTERNAL_MD5=y
407 CONFIG_INTERNAL_SHA256=y
408 endif
409 endif
410 else
411 CONFIG_INTERNAL_AES=y
412 CONFIG_INTERNAL_SHA1=y
413 CONFIG_INTERNAL_MD5=y
414 CONFIG_INTERNAL_SHA256=y
415 endif
416
417 ifdef CONFIG_INTERNAL_AES
418 CFLAGS += -DINTERNAL_AES
419 endif
420 ifdef CONFIG_INTERNAL_SHA1
421 CFLAGS += -DINTERNAL_SHA1
422 endif
423 ifdef CONFIG_INTERNAL_SHA256
424 CFLAGS += -DINTERNAL_SHA256
425 endif
426 ifdef CONFIG_INTERNAL_MD5
427 CFLAGS += -DINTERNAL_MD5
428 endif
429 ifdef CONFIG_INTERNAL_MD4
430 CFLAGS += -DINTERNAL_MD4
431 endif
432 ifdef CONFIG_INTERNAL_DES
433 CFLAGS += -DINTERNAL_DES
434 endif
435
436 ifdef NEED_SHA256
437 OBJS += ../src/crypto/sha256.o
438 endif
439
440 ifdef NEED_DH_GROUPS
441 OBJS += ../src/crypto/dh_groups.o
442 endif
443
444 ifndef NEED_FIPS186_2_PRF
445 CFLAGS += -DCONFIG_NO_FIPS186_2_PRF
446 endif
447
448 ifndef NEED_T_PRF
449 CFLAGS += -DCONFIG_NO_T_PRF
450 endif
451
452 ifdef CONFIG_RADIUS_SERVER
453 CFLAGS += -DRADIUS_SERVER
454 OBJS += ../src/radius/radius_server.o
455 endif
456
457 ifdef CONFIG_IPV6
458 CFLAGS += -DCONFIG_IPV6
459 endif
460
461 ifdef CONFIG_DRIVER_RADIUS_ACL
462 CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
463 endif
464
465 ifdef CONFIG_FULL_DYNAMIC_VLAN
466 # define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
467 # and vlan interfaces for the vlan feature.
468 CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
469 endif
470
471 ifdef NEED_BASE64
472 OBJS += ../src/utils/base64.o
473 endif
474
475 ALL=hostapd hostapd_cli
476
477 all: verify_config $(ALL)
478
479 verify_config:
480         @if [ ! -r .config ]; then \
481                 echo 'Building hostapd requires a configuration file'; \
482                 echo '(.config). See README for more instructions. You can'; \
483                 echo 'run "cp defconfig .config" to create an example'; \
484                 echo 'configuration.'; \
485                 exit 1; \
486         fi
487
488 install: all
489         for i in $(ALL); do cp $$i /usr/local/bin/$$i; done
490
491 hostapd: $(OBJS)
492         $(CC) -o hostapd $(OBJS) $(LIBS)
493
494 OBJS_c = hostapd_cli.o ../src/common/wpa_ctrl.o ../src/utils/os_$(CONFIG_OS).o
495 hostapd_cli: $(OBJS_c)
496         $(CC) -o hostapd_cli $(OBJS_c)
497
498 NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o ../src/crypto/sha1.o ../src/crypto/rc4.o ../src/crypto/md5.o
499 NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o
500 ifdef TLS_FUNCS
501 LIBS_n += -lcrypto
502 endif
503
504 nt_password_hash: $(NOBJS)
505         $(CC) -o nt_password_hash $(NOBJS) $(LIBS_n)
506
507 hlr_auc_gw: $(HOBJS)
508         $(CC) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
509
510 clean:
511         $(MAKE) -C ../src clean
512         rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
513         rm -f *.d
514
515 %.eps: %.fig
516         fig2dev -L eps $*.fig $*.eps
517
518 %.png: %.fig
519         fig2dev -L png -m 3 $*.fig | pngtopnm | pnmscale 0.4 | pnmtopng \
520                 > $*.png
521
522 docs-pics: doc/hostapd.png doc/hostapd.eps
523
524 docs: docs-pics
525         doxygen doc/doxygen.full
526         $(MAKE) -C doc/latex
527         cp doc/latex/refman.pdf hostapd-devel.pdf
528
529 docs-fast: docs-pics
530         doxygen doc/doxygen.fast
531
532 clean-docs:
533         rm -rf doc/latex doc/html
534         rm -f doc/hosta.d{eps,png} hostapd-devel.pdf
535
536 TEST_SRC_MILENAGE = ../src/hlr_auc_gw/milenage.c ../src/crypto/aes_wrap.c ../src/crypto/aes.c ../src/utils/common.c ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).c
537 test-milenage: $(TEST_SRC_MILENAGE)
538         $(CC) -o test-milenage -Wall -Werror $(TEST_SRC_MILENAGE) \
539                 -DTEST_MAIN_MILENAGE -I. -DINTERNAL_AES \
540                 -I../src/crypto -I../src/utils
541         ./test-milenage
542         rm test-milenage
543
544 hostapd-sparse: $(OBJS)
545         @echo Sparse run completed
546
547 run-sparse:
548         CC="sparse -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -D__INT_MAX__=2147483647 -D__SHRT_MAX__=32767 -D__LONG_MAX__=2147483647 -D__SCHAR_MAX__=127 -Wbitwise" $(MAKE) hostapd-sparse
549
550 -include $(OBJS:%.o=%.d)