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