Makefile revision 9866086a955d00e237cc8df3722e7dff75c02532
1ifndef CC
2CC=gcc
3endif
4
5ifndef CFLAGS
6CFLAGS = -MMD -O2 -Wall -g
7endif
8
9CFLAGS += -I$(abspath ../src)
10CFLAGS += -I$(abspath ../src/utils)
11
12# Uncomment following line and set the path to your kernel tree include
13# directory if your C library does not include all header files.
14# CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
15
16-include .config
17
18ifdef CONFIG_TESTING_OPTIONS
19CFLAGS += -DCONFIG_TESTING_OPTIONS
20CONFIG_WPS_TESTING=y
21endif
22
23ifndef CONFIG_OS
24ifdef CONFIG_NATIVE_WINDOWS
25CONFIG_OS=win32
26else
27CONFIG_OS=unix
28endif
29endif
30
31ifeq ($(CONFIG_OS), internal)
32CFLAGS += -DOS_NO_C_LIB_DEFINES
33endif
34
35ifdef CONFIG_NATIVE_WINDOWS
36CFLAGS += -DCONFIG_NATIVE_WINDOWS
37LIBS += -lws2_32
38endif
39
40OBJS += main.o
41OBJS += config_file.o
42
43OBJS += ../src/ap/hostapd.o
44OBJS += ../src/ap/wpa_auth_glue.o
45OBJS += ../src/ap/drv_callbacks.o
46OBJS += ../src/ap/ap_drv_ops.o
47OBJS += ../src/ap/utils.o
48OBJS += ../src/ap/authsrv.o
49OBJS += ../src/ap/ieee802_1x.o
50OBJS += ../src/ap/ap_config.o
51OBJS += ../src/ap/eap_user_db.o
52OBJS += ../src/ap/ieee802_11_auth.o
53OBJS += ../src/ap/sta_info.o
54OBJS += ../src/ap/wpa_auth.o
55OBJS += ../src/ap/tkip_countermeasures.o
56OBJS += ../src/ap/ap_mlme.o
57OBJS += ../src/ap/wpa_auth_ie.o
58OBJS += ../src/ap/preauth_auth.o
59OBJS += ../src/ap/pmksa_cache_auth.o
60OBJS += ../src/ap/ieee802_11_shared.o
61OBJS += ../src/ap/beacon.o
62
63OBJS_c = hostapd_cli.o ../src/common/wpa_ctrl.o ../src/utils/os_$(CONFIG_OS).o
64
65NEED_RC4=y
66NEED_AES=y
67NEED_MD5=y
68NEED_SHA1=y
69
70OBJS += ../src/drivers/drivers.o
71CFLAGS += -DHOSTAPD
72
73ifdef CONFIG_MODULE_TESTS
74CFLAGS += -DCONFIG_MODULE_TESTS
75OBJS += hapd_module_tests.o
76endif
77
78ifdef CONFIG_WPA_TRACE
79CFLAGS += -DWPA_TRACE
80OBJS += ../src/utils/trace.o
81HOBJS += ../src/utils/trace.o
82LDFLAGS += -rdynamic
83CFLAGS += -funwind-tables
84ifdef CONFIG_WPA_TRACE_BFD
85CFLAGS += -DPACKAGE="hostapd" -DWPA_TRACE_BFD
86LIBS += -lbfd -ldl -liberty -lz
87LIBS_c += -lbfd -ldl -liberty -lz
88LIBS_h += -lbfd -ldl -liberty -lz
89endif
90endif
91
92ifndef CONFIG_ELOOP
93CONFIG_ELOOP=eloop
94endif
95OBJS += ../src/utils/$(CONFIG_ELOOP).o
96OBJS_c += ../src/utils/$(CONFIG_ELOOP).o
97
98ifeq ($(CONFIG_ELOOP), eloop)
99# Using glibc < 2.17 requires -lrt for clock_gettime()
100LIBS += -lrt
101LIBS_c += -lrt
102LIBS_h += -lrt
103LIBS_n += -lrt
104endif
105
106OBJS += ../src/utils/common.o
107OBJS += ../src/utils/wpa_debug.o
108OBJS_c += ../src/utils/wpa_debug.o
109OBJS += ../src/utils/wpabuf.o
110OBJS += ../src/utils/os_$(CONFIG_OS).o
111OBJS += ../src/utils/ip_addr.o
112
113OBJS += ../src/common/ieee802_11_common.o
114OBJS += ../src/common/wpa_common.o
115
116OBJS += ../src/eapol_auth/eapol_auth_sm.o
117
118
119ifdef CONFIG_CODE_COVERAGE
120CFLAGS += -O0 -fprofile-arcs -ftest-coverage
121LIBS += -lgcov
122LIBS_c += -lgcov
123LIBS_h += -lgcov
124LIBS_n += -lgcov
125endif
126
127ifndef CONFIG_NO_DUMP_STATE
128# define HOSTAPD_DUMP_STATE to include support for dumping internal state
129# through control interface commands (undefine it, if you want to save in
130# binary size)
131CFLAGS += -DHOSTAPD_DUMP_STATE
132OBJS += ../src/eapol_auth/eapol_auth_dump.o
133endif
134
135ifdef CONFIG_NO_RADIUS
136CFLAGS += -DCONFIG_NO_RADIUS
137CONFIG_NO_ACCOUNTING=y
138else
139OBJS += ../src/radius/radius.o
140OBJS += ../src/radius/radius_client.o
141OBJS += ../src/radius/radius_das.o
142endif
143
144ifdef CONFIG_NO_ACCOUNTING
145CFLAGS += -DCONFIG_NO_ACCOUNTING
146else
147OBJS += ../src/ap/accounting.o
148endif
149
150ifdef CONFIG_NO_VLAN
151CFLAGS += -DCONFIG_NO_VLAN
152else
153OBJS += ../src/ap/vlan_init.o
154ifdef CONFIG_VLAN_NETLINK
155ifdef CONFIG_FULL_DYNAMIC_VLAN
156OBJS += ../src/ap/vlan_util.o
157endif
158CFLAGS += -DCONFIG_VLAN_NETLINK
159endif
160endif
161
162ifdef CONFIG_NO_CTRL_IFACE
163CFLAGS += -DCONFIG_NO_CTRL_IFACE
164else
165OBJS += ctrl_iface.o
166OBJS += ../src/ap/ctrl_iface_ap.o
167endif
168
169OBJS += ../src/crypto/md5.o
170
171CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX
172
173ifdef CONFIG_IAPP
174CFLAGS += -DCONFIG_IAPP
175OBJS += ../src/ap/iapp.o
176endif
177
178ifdef CONFIG_RSN_PREAUTH
179CFLAGS += -DCONFIG_RSN_PREAUTH
180CONFIG_L2_PACKET=y
181endif
182
183ifdef CONFIG_PEERKEY
184CFLAGS += -DCONFIG_PEERKEY
185OBJS += ../src/ap/peerkey_auth.o
186endif
187
188ifdef CONFIG_HS20
189NEED_AES_OMAC1=y
190endif
191
192ifdef CONFIG_IEEE80211W
193CFLAGS += -DCONFIG_IEEE80211W
194NEED_SHA256=y
195NEED_AES_OMAC1=y
196endif
197
198ifdef CONFIG_IEEE80211R
199CFLAGS += -DCONFIG_IEEE80211R
200OBJS += ../src/ap/wpa_auth_ft.o
201NEED_SHA256=y
202NEED_AES_OMAC1=y
203NEED_AES_UNWRAP=y
204endif
205
206ifdef CONFIG_SAE
207CFLAGS += -DCONFIG_SAE
208OBJS += ../src/common/sae.o
209NEED_ECC=y
210NEED_DH_GROUPS=y
211endif
212
213ifdef CONFIG_WNM
214CFLAGS += -DCONFIG_WNM
215OBJS += ../src/ap/wnm_ap.o
216endif
217
218ifdef CONFIG_IEEE80211N
219CFLAGS += -DCONFIG_IEEE80211N
220endif
221
222ifdef CONFIG_IEEE80211AC
223CFLAGS += -DCONFIG_IEEE80211AC
224endif
225
226include ../src/drivers/drivers.mak
227OBJS += $(DRV_AP_OBJS)
228CFLAGS += $(DRV_AP_CFLAGS)
229LDFLAGS += $(DRV_AP_LDFLAGS)
230LIBS += $(DRV_AP_LIBS)
231
232ifdef CONFIG_L2_PACKET
233ifdef CONFIG_DNET_PCAP
234ifdef CONFIG_L2_FREEBSD
235LIBS += -lpcap
236OBJS += ../src/l2_packet/l2_packet_freebsd.o
237else
238LIBS += -ldnet -lpcap
239OBJS += ../src/l2_packet/l2_packet_pcap.o
240endif
241else
242OBJS += ../src/l2_packet/l2_packet_linux.o
243endif
244else
245OBJS += ../src/l2_packet/l2_packet_none.o
246endif
247
248
249ifdef CONFIG_EAP_MD5
250CFLAGS += -DEAP_SERVER_MD5
251OBJS += ../src/eap_server/eap_server_md5.o
252CHAP=y
253endif
254
255ifdef CONFIG_EAP_TLS
256CFLAGS += -DEAP_SERVER_TLS
257OBJS += ../src/eap_server/eap_server_tls.o
258TLS_FUNCS=y
259endif
260
261ifdef CONFIG_EAP_UNAUTH_TLS
262CFLAGS += -DEAP_SERVER_UNAUTH_TLS
263ifndef CONFIG_EAP_TLS
264OBJS += ../src/eap_server/eap_server_tls.o
265TLS_FUNCS=y
266endif
267endif
268
269ifdef CONFIG_EAP_PEAP
270CFLAGS += -DEAP_SERVER_PEAP
271OBJS += ../src/eap_server/eap_server_peap.o
272OBJS += ../src/eap_common/eap_peap_common.o
273TLS_FUNCS=y
274CONFIG_EAP_MSCHAPV2=y
275endif
276
277ifdef CONFIG_EAP_TTLS
278CFLAGS += -DEAP_SERVER_TTLS
279OBJS += ../src/eap_server/eap_server_ttls.o
280TLS_FUNCS=y
281CHAP=y
282endif
283
284ifdef CONFIG_EAP_MSCHAPV2
285CFLAGS += -DEAP_SERVER_MSCHAPV2
286OBJS += ../src/eap_server/eap_server_mschapv2.o
287MS_FUNCS=y
288endif
289
290ifdef CONFIG_EAP_GTC
291CFLAGS += -DEAP_SERVER_GTC
292OBJS += ../src/eap_server/eap_server_gtc.o
293endif
294
295ifdef CONFIG_EAP_SIM
296CFLAGS += -DEAP_SERVER_SIM
297OBJS += ../src/eap_server/eap_server_sim.o
298CONFIG_EAP_SIM_COMMON=y
299NEED_AES_CBC=y
300endif
301
302ifdef CONFIG_EAP_AKA
303CFLAGS += -DEAP_SERVER_AKA
304OBJS += ../src/eap_server/eap_server_aka.o
305CONFIG_EAP_SIM_COMMON=y
306NEED_SHA256=y
307NEED_AES_CBC=y
308endif
309
310ifdef CONFIG_EAP_AKA_PRIME
311CFLAGS += -DEAP_SERVER_AKA_PRIME
312endif
313
314ifdef CONFIG_EAP_SIM_COMMON
315OBJS += ../src/eap_common/eap_sim_common.o
316# Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
317# replaced with another file implementating the interface specified in
318# eap_sim_db.h.
319OBJS += ../src/eap_server/eap_sim_db.o
320NEED_FIPS186_2_PRF=y
321endif
322
323ifdef CONFIG_EAP_PAX
324CFLAGS += -DEAP_SERVER_PAX
325OBJS += ../src/eap_server/eap_server_pax.o ../src/eap_common/eap_pax_common.o
326endif
327
328ifdef CONFIG_EAP_PSK
329CFLAGS += -DEAP_SERVER_PSK
330OBJS += ../src/eap_server/eap_server_psk.o ../src/eap_common/eap_psk_common.o
331NEED_AES_OMAC1=y
332NEED_AES_ENCBLOCK=y
333NEED_AES_EAX=y
334endif
335
336ifdef CONFIG_EAP_SAKE
337CFLAGS += -DEAP_SERVER_SAKE
338OBJS += ../src/eap_server/eap_server_sake.o ../src/eap_common/eap_sake_common.o
339endif
340
341ifdef CONFIG_EAP_GPSK
342CFLAGS += -DEAP_SERVER_GPSK
343OBJS += ../src/eap_server/eap_server_gpsk.o ../src/eap_common/eap_gpsk_common.o
344ifdef CONFIG_EAP_GPSK_SHA256
345CFLAGS += -DEAP_GPSK_SHA256
346endif
347NEED_SHA256=y
348NEED_AES_OMAC1=y
349endif
350
351ifdef CONFIG_EAP_PWD
352CFLAGS += -DEAP_SERVER_PWD
353OBJS += ../src/eap_server/eap_server_pwd.o ../src/eap_common/eap_pwd_common.o
354NEED_SHA256=y
355endif
356
357ifdef CONFIG_EAP_EKE
358CFLAGS += -DEAP_SERVER_EKE
359OBJS += ../src/eap_server/eap_server_eke.o ../src/eap_common/eap_eke_common.o
360NEED_DH_GROUPS=y
361NEED_DH_GROUPS_ALL=y
362endif
363
364ifdef CONFIG_EAP_VENDOR_TEST
365CFLAGS += -DEAP_SERVER_VENDOR_TEST
366OBJS += ../src/eap_server/eap_server_vendor_test.o
367endif
368
369ifdef CONFIG_EAP_FAST
370CFLAGS += -DEAP_SERVER_FAST
371OBJS += ../src/eap_server/eap_server_fast.o
372OBJS += ../src/eap_common/eap_fast_common.o
373TLS_FUNCS=y
374NEED_T_PRF=y
375NEED_AES_UNWRAP=y
376endif
377
378ifdef CONFIG_WPS
379ifdef CONFIG_WPS2
380CFLAGS += -DCONFIG_WPS2
381endif
382
383CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC
384OBJS += ../src/utils/uuid.o
385OBJS += ../src/ap/wps_hostapd.o
386OBJS += ../src/eap_server/eap_server_wsc.o ../src/eap_common/eap_wsc_common.o
387OBJS += ../src/wps/wps.o
388OBJS += ../src/wps/wps_common.o
389OBJS += ../src/wps/wps_attr_parse.o
390OBJS += ../src/wps/wps_attr_build.o
391OBJS += ../src/wps/wps_attr_process.o
392OBJS += ../src/wps/wps_dev_attr.o
393OBJS += ../src/wps/wps_enrollee.o
394OBJS += ../src/wps/wps_registrar.o
395NEED_DH_GROUPS=y
396NEED_SHA256=y
397NEED_BASE64=y
398NEED_AES_CBC=y
399NEED_MODEXP=y
400CONFIG_EAP=y
401
402ifdef CONFIG_WPS_NFC
403CFLAGS += -DCONFIG_WPS_NFC
404OBJS += ../src/wps/ndef.o
405NEED_WPS_OOB=y
406endif
407
408ifdef NEED_WPS_OOB
409CFLAGS += -DCONFIG_WPS_OOB
410endif
411
412ifdef CONFIG_WPS_UPNP
413CFLAGS += -DCONFIG_WPS_UPNP
414OBJS += ../src/wps/wps_upnp.o
415OBJS += ../src/wps/wps_upnp_ssdp.o
416OBJS += ../src/wps/wps_upnp_web.o
417OBJS += ../src/wps/wps_upnp_event.o
418OBJS += ../src/wps/wps_upnp_ap.o
419OBJS += ../src/wps/upnp_xml.o
420OBJS += ../src/wps/httpread.o
421OBJS += ../src/wps/http_client.o
422OBJS += ../src/wps/http_server.o
423endif
424
425ifdef CONFIG_WPS_STRICT
426CFLAGS += -DCONFIG_WPS_STRICT
427OBJS += ../src/wps/wps_validate.o
428endif
429
430ifdef CONFIG_WPS_TESTING
431CFLAGS += -DCONFIG_WPS_TESTING
432endif
433
434endif
435
436ifdef CONFIG_EAP_IKEV2
437CFLAGS += -DEAP_SERVER_IKEV2
438OBJS += ../src/eap_server/eap_server_ikev2.o ../src/eap_server/ikev2.o
439OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
440NEED_DH_GROUPS=y
441NEED_DH_GROUPS_ALL=y
442NEED_MODEXP=y
443NEED_CIPHER=y
444endif
445
446ifdef CONFIG_EAP_TNC
447CFLAGS += -DEAP_SERVER_TNC
448OBJS += ../src/eap_server/eap_server_tnc.o
449OBJS += ../src/eap_server/tncs.o
450NEED_BASE64=y
451ifndef CONFIG_DRIVER_BSD
452LIBS += -ldl
453endif
454endif
455
456# Basic EAP functionality is needed for EAPOL
457OBJS += eap_register.o
458OBJS += ../src/eap_server/eap_server.o
459OBJS += ../src/eap_common/eap_common.o
460OBJS += ../src/eap_server/eap_server_methods.o
461OBJS += ../src/eap_server/eap_server_identity.o
462CFLAGS += -DEAP_SERVER_IDENTITY
463
464ifdef CONFIG_EAP
465CFLAGS += -DEAP_SERVER
466endif
467
468ifdef CONFIG_PKCS12
469CFLAGS += -DPKCS12_FUNCS
470endif
471
472ifdef MS_FUNCS
473OBJS += ../src/crypto/ms_funcs.o
474NEED_DES=y
475NEED_MD4=y
476endif
477
478ifdef CHAP
479OBJS += ../src/eap_common/chap.o
480endif
481
482ifdef TLS_FUNCS
483NEED_DES=y
484# Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
485CFLAGS += -DEAP_TLS_FUNCS
486OBJS += ../src/eap_server/eap_server_tls_common.o
487NEED_TLS_PRF=y
488endif
489
490ifndef CONFIG_TLS
491CONFIG_TLS=openssl
492endif
493
494ifdef CONFIG_TLSV11
495CFLAGS += -DCONFIG_TLSV11
496endif
497
498ifdef CONFIG_TLSV12
499CFLAGS += -DCONFIG_TLSV12
500NEED_SHA256=y
501endif
502
503ifeq ($(CONFIG_TLS), openssl)
504ifdef TLS_FUNCS
505OBJS += ../src/crypto/tls_openssl.o
506LIBS += -lssl
507endif
508OBJS += ../src/crypto/crypto_openssl.o
509HOBJS += ../src/crypto/crypto_openssl.o
510ifdef NEED_FIPS186_2_PRF
511OBJS += ../src/crypto/fips_prf_openssl.o
512endif
513LIBS += -lcrypto
514LIBS_h += -lcrypto
515endif
516
517ifeq ($(CONFIG_TLS), gnutls)
518ifdef TLS_FUNCS
519OBJS += ../src/crypto/tls_gnutls.o
520LIBS += -lgnutls -lgpg-error
521endif
522OBJS += ../src/crypto/crypto_gnutls.o
523HOBJS += ../src/crypto/crypto_gnutls.o
524ifdef NEED_FIPS186_2_PRF
525OBJS += ../src/crypto/fips_prf_internal.o
526SHA1OBJS += ../src/crypto/sha1-internal.o
527endif
528LIBS += -lgcrypt
529LIBS_h += -lgcrypt
530CONFIG_INTERNAL_SHA256=y
531CONFIG_INTERNAL_RC4=y
532CONFIG_INTERNAL_DH_GROUP5=y
533endif
534
535ifeq ($(CONFIG_TLS), schannel)
536ifdef TLS_FUNCS
537OBJS += ../src/crypto/tls_schannel.o
538endif
539OBJS += ../src/crypto/crypto_cryptoapi.o
540OBJS_p += ../src/crypto/crypto_cryptoapi.o
541CONFIG_INTERNAL_SHA256=y
542CONFIG_INTERNAL_RC4=y
543CONFIG_INTERNAL_DH_GROUP5=y
544endif
545
546ifeq ($(CONFIG_TLS), nss)
547ifdef TLS_FUNCS
548OBJS += ../src/crypto/tls_nss.o
549LIBS += -lssl3
550endif
551OBJS += ../src/crypto/crypto_nss.o
552ifdef NEED_FIPS186_2_PRF
553OBJS += ../src/crypto/fips_prf_internal.o
554SHA1OBJS += ../src/crypto/sha1-internal.o
555endif
556LIBS += -lnss3
557LIBS_h += -lnss3
558CONFIG_INTERNAL_MD4=y
559CONFIG_INTERNAL_DH_GROUP5=y
560endif
561
562ifeq ($(CONFIG_TLS), internal)
563ifndef CONFIG_CRYPTO
564CONFIG_CRYPTO=internal
565endif
566ifdef TLS_FUNCS
567OBJS += ../src/crypto/crypto_internal-rsa.o
568OBJS += ../src/crypto/tls_internal.o
569OBJS += ../src/tls/tlsv1_common.o
570OBJS += ../src/tls/tlsv1_record.o
571OBJS += ../src/tls/tlsv1_cred.o
572OBJS += ../src/tls/tlsv1_server.o
573OBJS += ../src/tls/tlsv1_server_write.o
574OBJS += ../src/tls/tlsv1_server_read.o
575OBJS += ../src/tls/asn1.o
576OBJS += ../src/tls/rsa.o
577OBJS += ../src/tls/x509v3.o
578OBJS += ../src/tls/pkcs1.o
579OBJS += ../src/tls/pkcs5.o
580OBJS += ../src/tls/pkcs8.o
581NEED_SHA256=y
582NEED_BASE64=y
583NEED_TLS_PRF=y
584ifdef CONFIG_TLSV12
585NEED_TLS_PRF_SHA256=y
586endif
587NEED_MODEXP=y
588NEED_CIPHER=y
589CFLAGS += -DCONFIG_TLS_INTERNAL
590CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
591endif
592ifdef NEED_CIPHER
593NEED_DES=y
594OBJS += ../src/crypto/crypto_internal-cipher.o
595endif
596ifdef NEED_MODEXP
597OBJS += ../src/crypto/crypto_internal-modexp.o
598OBJS += ../src/tls/bignum.o
599endif
600ifeq ($(CONFIG_CRYPTO), libtomcrypt)
601OBJS += ../src/crypto/crypto_libtomcrypt.o
602LIBS += -ltomcrypt -ltfm
603LIBS_h += -ltomcrypt -ltfm
604CONFIG_INTERNAL_SHA256=y
605CONFIG_INTERNAL_RC4=y
606CONFIG_INTERNAL_DH_GROUP5=y
607endif
608ifeq ($(CONFIG_CRYPTO), internal)
609OBJS += ../src/crypto/crypto_internal.o
610NEED_AES_DEC=y
611CFLAGS += -DCONFIG_CRYPTO_INTERNAL
612ifdef CONFIG_INTERNAL_LIBTOMMATH
613CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
614ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST
615CFLAGS += -DLTM_FAST
616endif
617else
618LIBS += -ltommath
619LIBS_h += -ltommath
620endif
621CONFIG_INTERNAL_AES=y
622CONFIG_INTERNAL_DES=y
623CONFIG_INTERNAL_SHA1=y
624CONFIG_INTERNAL_MD4=y
625CONFIG_INTERNAL_MD5=y
626CONFIG_INTERNAL_SHA256=y
627CONFIG_INTERNAL_RC4=y
628CONFIG_INTERNAL_DH_GROUP5=y
629endif
630ifeq ($(CONFIG_CRYPTO), cryptoapi)
631OBJS += ../src/crypto/crypto_cryptoapi.o
632OBJS_p += ../src/crypto/crypto_cryptoapi.o
633CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI
634CONFIG_INTERNAL_SHA256=y
635CONFIG_INTERNAL_RC4=y
636endif
637endif
638
639ifeq ($(CONFIG_TLS), none)
640ifdef TLS_FUNCS
641OBJS += ../src/crypto/tls_none.o
642CFLAGS += -DEAP_TLS_NONE
643CONFIG_INTERNAL_AES=y
644CONFIG_INTERNAL_SHA1=y
645CONFIG_INTERNAL_MD5=y
646endif
647OBJS += ../src/crypto/crypto_none.o
648OBJS_p += ../src/crypto/crypto_none.o
649CONFIG_INTERNAL_SHA256=y
650CONFIG_INTERNAL_RC4=y
651endif
652
653ifndef TLS_FUNCS
654OBJS += ../src/crypto/tls_none.o
655ifeq ($(CONFIG_TLS), internal)
656CONFIG_INTERNAL_AES=y
657CONFIG_INTERNAL_SHA1=y
658CONFIG_INTERNAL_MD5=y
659CONFIG_INTERNAL_RC4=y
660endif
661endif
662
663AESOBJS = # none so far
664ifdef CONFIG_INTERNAL_AES
665AESOBJS += ../src/crypto/aes-internal.o ../src/crypto/aes-internal-enc.o
666endif
667
668AESOBJS += ../src/crypto/aes-wrap.o
669ifdef NEED_AES_EAX
670AESOBJS += ../src/crypto/aes-eax.o
671NEED_AES_CTR=y
672endif
673ifdef NEED_AES_CTR
674AESOBJS += ../src/crypto/aes-ctr.o
675endif
676ifdef NEED_AES_ENCBLOCK
677AESOBJS += ../src/crypto/aes-encblock.o
678endif
679ifdef NEED_AES_OMAC1
680AESOBJS += ../src/crypto/aes-omac1.o
681endif
682ifdef NEED_AES_UNWRAP
683NEED_AES_DEC=y
684AESOBJS += ../src/crypto/aes-unwrap.o
685endif
686ifdef NEED_AES_CBC
687NEED_AES_DEC=y
688AESOBJS += ../src/crypto/aes-cbc.o
689endif
690ifdef NEED_AES_DEC
691ifdef CONFIG_INTERNAL_AES
692AESOBJS += ../src/crypto/aes-internal-dec.o
693endif
694endif
695ifdef NEED_AES
696OBJS += $(AESOBJS)
697endif
698
699ifdef NEED_SHA1
700ifneq ($(CONFIG_TLS), openssl)
701SHA1OBJS += ../src/crypto/sha1.o
702endif
703SHA1OBJS += ../src/crypto/sha1-prf.o
704ifdef CONFIG_INTERNAL_SHA1
705SHA1OBJS += ../src/crypto/sha1-internal.o
706ifdef NEED_FIPS186_2_PRF
707SHA1OBJS += ../src/crypto/fips_prf_internal.o
708endif
709endif
710ifneq ($(CONFIG_TLS), openssl)
711SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
712endif
713ifdef NEED_T_PRF
714SHA1OBJS += ../src/crypto/sha1-tprf.o
715endif
716ifdef NEED_TLS_PRF
717SHA1OBJS += ../src/crypto/sha1-tlsprf.o
718endif
719endif
720
721ifdef NEED_SHA1
722OBJS += $(SHA1OBJS)
723endif
724
725ifdef NEED_MD5
726ifdef CONFIG_INTERNAL_MD5
727OBJS += ../src/crypto/md5-internal.o
728HOBJS += ../src/crypto/md5-internal.o
729endif
730endif
731
732ifdef NEED_MD4
733ifdef CONFIG_INTERNAL_MD4
734OBJS += ../src/crypto/md4-internal.o
735endif
736endif
737
738ifdef NEED_DES
739ifdef CONFIG_INTERNAL_DES
740OBJS += ../src/crypto/des-internal.o
741endif
742endif
743
744ifdef NEED_RC4
745ifdef CONFIG_INTERNAL_RC4
746OBJS += ../src/crypto/rc4.o
747endif
748endif
749
750ifdef NEED_SHA256
751CFLAGS += -DCONFIG_SHA256
752ifneq ($(CONFIG_TLS), openssl)
753OBJS += ../src/crypto/sha256.o
754endif
755OBJS += ../src/crypto/sha256-prf.o
756ifdef CONFIG_INTERNAL_SHA256
757OBJS += ../src/crypto/sha256-internal.o
758endif
759ifdef NEED_TLS_PRF_SHA256
760OBJS += ../src/crypto/sha256-tlsprf.o
761endif
762endif
763
764ifdef NEED_DH_GROUPS
765OBJS += ../src/crypto/dh_groups.o
766endif
767ifdef NEED_DH_GROUPS_ALL
768CFLAGS += -DALL_DH_GROUPS
769endif
770ifdef CONFIG_INTERNAL_DH_GROUP5
771ifdef NEED_DH_GROUPS
772OBJS += ../src/crypto/dh_group5.o
773endif
774endif
775
776ifdef NEED_ECC
777CFLAGS += -DCONFIG_ECC
778endif
779
780ifdef CONFIG_NO_RANDOM_POOL
781CFLAGS += -DCONFIG_NO_RANDOM_POOL
782else
783OBJS += ../src/crypto/random.o
784HOBJS += ../src/crypto/random.o
785HOBJS += ../src/utils/eloop.o
786HOBJS += $(SHA1OBJS)
787HOBJS += ../src/crypto/md5.o
788endif
789
790ifdef CONFIG_RADIUS_SERVER
791CFLAGS += -DRADIUS_SERVER
792OBJS += ../src/radius/radius_server.o
793endif
794
795ifdef CONFIG_IPV6
796CFLAGS += -DCONFIG_IPV6
797endif
798
799ifdef CONFIG_DRIVER_RADIUS_ACL
800CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
801endif
802
803ifdef CONFIG_FULL_DYNAMIC_VLAN
804# define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
805# and vlan interfaces for the vlan feature.
806CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
807endif
808
809ifdef NEED_BASE64
810OBJS += ../src/utils/base64.o
811endif
812
813ifdef NEED_AP_MLME
814OBJS += ../src/ap/wmm.o
815OBJS += ../src/ap/ap_list.o
816OBJS += ../src/ap/ieee802_11.o
817OBJS += ../src/ap/hw_features.o
818OBJS += ../src/ap/dfs.o
819CFLAGS += -DNEED_AP_MLME
820endif
821ifdef CONFIG_IEEE80211N
822OBJS += ../src/ap/ieee802_11_ht.o
823endif
824
825ifdef CONFIG_IEEE80211AC
826OBJS += ../src/ap/ieee802_11_vht.o
827endif
828
829ifdef CONFIG_P2P_MANAGER
830CFLAGS += -DCONFIG_P2P_MANAGER
831OBJS += ../src/ap/p2p_hostapd.o
832endif
833
834ifdef CONFIG_HS20
835CFLAGS += -DCONFIG_HS20
836OBJS += ../src/ap/hs20.o
837CONFIG_INTERWORKING=y
838endif
839
840ifdef CONFIG_INTERWORKING
841CFLAGS += -DCONFIG_INTERWORKING
842OBJS += ../src/common/gas.o
843OBJS += ../src/ap/gas_serv.o
844endif
845
846OBJS += ../src/drivers/driver_common.o
847
848ifdef CONFIG_WPA_CLI_EDIT
849OBJS_c += ../src/utils/edit.o
850else
851OBJS_c += ../src/utils/edit_simple.o
852endif
853
854ifdef CONFIG_ACS
855CFLAGS += -DCONFIG_ACS
856OBJS += ../src/ap/acs.o
857LIBS += -lm
858endif
859
860ifdef CONFIG_NO_STDOUT_DEBUG
861CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
862endif
863
864ifdef CONFIG_DEBUG_LINUX_TRACING
865CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING
866endif
867
868ifdef CONFIG_DEBUG_FILE
869CFLAGS += -DCONFIG_DEBUG_FILE
870endif
871
872ifdef CONFIG_SQLITE
873CFLAGS += -DCONFIG_SQLITE
874LIBS += -lsqlite3
875LIBS_h += -lsqlite3
876endif
877
878ALL=hostapd hostapd_cli
879
880all: verify_config $(ALL)
881
882Q=@
883E=echo
884ifeq ($(V), 1)
885Q=
886E=true
887endif
888
889ifdef CONFIG_CODE_COVERAGE
890%.o: %.c
891	@$(E) "  CC " $<
892	$(Q)cd $(dir $@); $(CC) -c -o $(notdir $@) $(CFLAGS) $(notdir $<)
893else
894%.o: %.c
895	$(Q)$(CC) -c -o $@ $(CFLAGS) $<
896	@$(E) "  CC " $<
897endif
898
899verify_config:
900	@if [ ! -r .config ]; then \
901		echo 'Building hostapd requires a configuration file'; \
902		echo '(.config). See README for more instructions. You can'; \
903		echo 'run "cp defconfig .config" to create an example'; \
904		echo 'configuration.'; \
905		exit 1; \
906	fi
907
908install: all
909	mkdir -p $(DESTDIR)/usr/local/bin
910	for i in $(ALL); do cp -f $$i $(DESTDIR)/usr/local/bin/$$i; done
911
912../src/drivers/build.hostapd:
913	@if [ -f ../src/drivers/build.wpa_supplicant ]; then \
914		$(MAKE) -C ../src/drivers clean; \
915	fi
916	@touch ../src/drivers/build.hostapd
917
918BCHECK=../src/drivers/build.hostapd
919
920hostapd: $(BCHECK) $(OBJS)
921	$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
922	@$(E) "  LD " $@
923
924ifdef CONFIG_WPA_TRACE
925OBJS_c += ../src/utils/trace.o
926endif
927hostapd_cli: $(OBJS_c)
928	$(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c)
929	@$(E) "  LD " $@
930
931NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) ../src/crypto/md5.o
932ifdef NEED_RC4
933ifdef CONFIG_INTERNAL_RC4
934NOBJS += ../src/crypto/rc4.o
935endif
936endif
937ifdef CONFIG_INTERNAL_MD5
938NOBJS += ../src/crypto/md5-internal.o
939endif
940NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o
941NOBJS += ../src/utils/wpa_debug.o
942NOBJS += ../src/utils/wpabuf.o
943ifdef CONFIG_WPA_TRACE
944NOBJS += ../src/utils/trace.o
945LIBS_n += -lbfd
946endif
947ifdef TLS_FUNCS
948LIBS_n += -lcrypto
949endif
950
951HOBJS += hlr_auc_gw.o ../src/utils/common.o ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).o ../src/utils/wpabuf.o ../src/crypto/milenage.o
952HOBJS += ../src/crypto/aes-encblock.o
953ifdef CONFIG_INTERNAL_AES
954HOBJS += ../src/crypto/aes-internal.o
955HOBJS += ../src/crypto/aes-internal-enc.o
956endif
957
958nt_password_hash: $(NOBJS)
959	$(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
960	@$(E) "  LD " $@
961
962hlr_auc_gw: $(HOBJS)
963	$(Q)$(CC) $(LDFLAGS) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
964	@$(E) "  LD " $@
965
966lcov-html:
967	lcov -c -d .. > lcov.info
968	genhtml lcov.info --output-directory lcov-html
969
970clean:
971	$(MAKE) -C ../src clean
972	rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
973	rm -f *.d *.gcno *.gcda *.gcov
974	rm -f lcov.info
975	rm -rf lcov-html
976
977-include $(OBJS:%.o=%.d)
978