1ifndef CC
2CC=gcc
3endif
4
5ifndef CFLAGS
6CFLAGS = -MMD -O2 -Wall -g
7endif
8
9export LIBDIR ?= /usr/local/lib/
10export BINDIR ?= /usr/local/sbin/
11PKG_CONFIG ?= pkg-config
12
13CFLAGS += -I$(abspath ../src)
14CFLAGS += -I$(abspath ../src/utils)
15
16-include .config
17
18ifdef CONFIG_TESTING_OPTIONS
19CFLAGS += -DCONFIG_TESTING_OPTIONS
20CONFIG_WPS_TESTING=y
21CONFIG_TDLS_TESTING=y
22endif
23
24BINALL=wpa_supplicant wpa_cli
25
26ifndef CONFIG_NO_WPA_PASSPHRASE
27BINALL += wpa_passphrase
28endif
29
30ALL = $(BINALL)
31ALL += systemd/wpa_supplicant.service
32ALL += systemd/wpa_supplicant@.service
33ALL += systemd/wpa_supplicant-nl80211@.service
34ALL += systemd/wpa_supplicant-wired@.service
35ALL += dbus/fi.epitest.hostap.WPASupplicant.service
36ALL += dbus/fi.w1.wpa_supplicant1.service
37
38
39all: verify_config $(ALL) dynamic_eap_methods
40
41verify_config:
42	@if [ ! -r .config ]; then \
43		echo 'Building wpa_supplicant requires a configuration file'; \
44		echo '(.config). See README for more instructions. You can'; \
45		echo 'run "cp defconfig .config" to create an example'; \
46		echo 'configuration.'; \
47		exit 1; \
48	fi
49
50mkconfig:
51	@if [ -f .config ]; then \
52		echo '.config exists - did not replace it'; \
53		exit 1; \
54	fi
55	echo CONFIG_DRIVER_HOSTAP=y >> .config
56	echo CONFIG_DRIVER_WEXT=y >> .config
57
58$(DESTDIR)$(BINDIR)/%: %
59	install -D $(<) $(@)
60
61install: $(addprefix $(DESTDIR)$(BINDIR)/,$(BINALL))
62	$(MAKE) -C ../src install
63
64ifdef CONFIG_FIPS
65CONFIG_NO_RANDOM_POOL=
66CONFIG_OPENSSL_CMAC=y
67endif
68
69OBJS = config.o
70OBJS += notify.o
71OBJS += bss.o
72OBJS += eap_register.o
73OBJS += ../src/utils/common.o
74OBJS += ../src/utils/wpa_debug.o
75OBJS += ../src/utils/wpabuf.o
76OBJS_p = wpa_passphrase.o
77OBJS_p += ../src/utils/common.o
78OBJS_p += ../src/utils/wpa_debug.o
79OBJS_p += ../src/utils/wpabuf.o
80OBJS_c = wpa_cli.o ../src/common/wpa_ctrl.o
81OBJS_c += ../src/utils/wpa_debug.o
82OBJS_c += ../src/utils/common.o
83
84ifndef CONFIG_OS
85ifdef CONFIG_NATIVE_WINDOWS
86CONFIG_OS=win32
87else
88CONFIG_OS=unix
89endif
90endif
91
92ifeq ($(CONFIG_OS), internal)
93CFLAGS += -DOS_NO_C_LIB_DEFINES
94endif
95
96OBJS += ../src/utils/os_$(CONFIG_OS).o
97OBJS_p += ../src/utils/os_$(CONFIG_OS).o
98OBJS_c += ../src/utils/os_$(CONFIG_OS).o
99
100ifdef CONFIG_WPA_TRACE
101CFLAGS += -DWPA_TRACE
102OBJS += ../src/utils/trace.o
103OBJS_p += ../src/utils/trace.o
104OBJS_c += ../src/utils/trace.o
105OBJS_priv += ../src/utils/trace.o
106LDFLAGS += -rdynamic
107CFLAGS += -funwind-tables
108ifdef CONFIG_WPA_TRACE_BFD
109CFLAGS += -DPACKAGE="wpa_supplicant" -DWPA_TRACE_BFD
110LIBS += -lbfd -ldl -liberty -lz
111LIBS_p += -lbfd -ldl -liberty -lz
112LIBS_c += -lbfd -ldl -liberty -lz
113endif
114endif
115
116ifndef CONFIG_ELOOP
117CONFIG_ELOOP=eloop
118endif
119OBJS += ../src/utils/$(CONFIG_ELOOP).o
120OBJS_c += ../src/utils/$(CONFIG_ELOOP).o
121
122ifeq ($(CONFIG_ELOOP), eloop)
123# Using glibc < 2.17 requires -lrt for clock_gettime()
124LIBS += -lrt
125LIBS_c += -lrt
126LIBS_p += -lrt
127endif
128
129ifdef CONFIG_ELOOP_POLL
130CFLAGS += -DCONFIG_ELOOP_POLL
131endif
132
133ifdef CONFIG_ELOOP_EPOLL
134CFLAGS += -DCONFIG_ELOOP_EPOLL
135endif
136
137ifdef CONFIG_EAPOL_TEST
138CFLAGS += -Werror -DEAPOL_TEST
139endif
140
141ifdef CONFIG_CODE_COVERAGE
142CFLAGS += -O0 -fprofile-arcs -ftest-coverage
143LIBS += -lgcov
144LIBS_c += -lgcov
145LIBS_p += -lgcov
146endif
147
148ifdef CONFIG_HT_OVERRIDES
149CFLAGS += -DCONFIG_HT_OVERRIDES
150endif
151
152ifdef CONFIG_VHT_OVERRIDES
153CFLAGS += -DCONFIG_VHT_OVERRIDES
154endif
155
156ifndef CONFIG_BACKEND
157CONFIG_BACKEND=file
158endif
159
160ifeq ($(CONFIG_BACKEND), file)
161OBJS += config_file.o
162ifndef CONFIG_NO_CONFIG_BLOBS
163NEED_BASE64=y
164endif
165CFLAGS += -DCONFIG_BACKEND_FILE
166endif
167
168ifeq ($(CONFIG_BACKEND), winreg)
169OBJS += config_winreg.o
170endif
171
172ifeq ($(CONFIG_BACKEND), none)
173OBJS += config_none.o
174endif
175
176ifdef CONFIG_NO_CONFIG_WRITE
177CFLAGS += -DCONFIG_NO_CONFIG_WRITE
178endif
179
180ifdef CONFIG_NO_CONFIG_BLOBS
181CFLAGS += -DCONFIG_NO_CONFIG_BLOBS
182endif
183
184ifdef CONFIG_NO_SCAN_PROCESSING
185CFLAGS += -DCONFIG_NO_SCAN_PROCESSING
186endif
187
188ifdef CONFIG_IEEE80211W
189CFLAGS += -DCONFIG_IEEE80211W
190NEED_SHA256=y
191NEED_AES_OMAC1=y
192endif
193
194ifdef CONFIG_IEEE80211R
195CFLAGS += -DCONFIG_IEEE80211R
196OBJS += ../src/rsn_supp/wpa_ft.o
197NEED_80211_COMMON=y
198NEED_SHA256=y
199NEED_AES_OMAC1=y
200endif
201
202ifdef CONFIG_SAE
203CFLAGS += -DCONFIG_SAE
204OBJS += ../src/common/sae.o
205NEED_ECC=y
206NEED_DH_GROUPS=y
207endif
208
209ifdef CONFIG_WNM
210CFLAGS += -DCONFIG_WNM
211OBJS += wnm_sta.o
212endif
213
214ifdef CONFIG_TDLS
215CFLAGS += -DCONFIG_TDLS
216OBJS += ../src/rsn_supp/tdls.o
217NEED_SHA256=y
218NEED_AES_OMAC1=y
219endif
220
221ifdef CONFIG_TDLS_TESTING
222CFLAGS += -DCONFIG_TDLS_TESTING
223endif
224
225ifdef CONFIG_PEERKEY
226CFLAGS += -DCONFIG_PEERKEY
227endif
228
229ifndef CONFIG_NO_WPA
230OBJS += ../src/rsn_supp/wpa.o
231OBJS += ../src/rsn_supp/preauth.o
232OBJS += ../src/rsn_supp/pmksa_cache.o
233OBJS += ../src/rsn_supp/peerkey.o
234OBJS += ../src/rsn_supp/wpa_ie.o
235OBJS += ../src/common/wpa_common.o
236NEED_AES=y
237NEED_SHA1=y
238NEED_MD5=y
239NEED_RC4=y
240else
241CFLAGS += -DCONFIG_NO_WPA
242endif
243
244ifdef CONFIG_IBSS_RSN
245NEED_RSN_AUTHENTICATOR=y
246CFLAGS += -DCONFIG_IBSS_RSN
247OBJS += ibss_rsn.o
248endif
249
250ifdef CONFIG_P2P
251OBJS += p2p_supplicant.o
252OBJS += ../src/p2p/p2p.o
253OBJS += ../src/p2p/p2p_utils.o
254OBJS += ../src/p2p/p2p_parse.o
255OBJS += ../src/p2p/p2p_build.o
256OBJS += ../src/p2p/p2p_go_neg.o
257OBJS += ../src/p2p/p2p_sd.o
258OBJS += ../src/p2p/p2p_pd.o
259OBJS += ../src/p2p/p2p_invitation.o
260OBJS += ../src/p2p/p2p_dev_disc.o
261OBJS += ../src/p2p/p2p_group.o
262OBJS += ../src/ap/p2p_hostapd.o
263OBJS += ../src/utils/bitfield.o
264CFLAGS += -DCONFIG_P2P
265NEED_GAS=y
266NEED_OFFCHANNEL=y
267NEED_80211_COMMON=y
268CONFIG_WPS=y
269CONFIG_AP=y
270ifdef CONFIG_P2P_STRICT
271CFLAGS += -DCONFIG_P2P_STRICT
272endif
273endif
274
275ifdef CONFIG_WIFI_DISPLAY
276CFLAGS += -DCONFIG_WIFI_DISPLAY
277OBJS += wifi_display.o
278endif
279
280ifdef CONFIG_HS20
281OBJS += hs20_supplicant.o
282CFLAGS += -DCONFIG_HS20
283CONFIG_INTERWORKING=y
284NEED_AES_OMAC1=y
285endif
286
287ifdef CONFIG_INTERWORKING
288OBJS += interworking.o
289CFLAGS += -DCONFIG_INTERWORKING
290NEED_GAS=y
291endif
292
293include ../src/drivers/drivers.mak
294ifdef CONFIG_AP
295OBJS_d += $(DRV_BOTH_OBJS)
296CFLAGS += $(DRV_BOTH_CFLAGS)
297LDFLAGS += $(DRV_BOTH_LDFLAGS)
298LIBS += $(DRV_BOTH_LIBS)
299else
300NEED_AP_MLME=
301OBJS_d += $(DRV_WPA_OBJS)
302CFLAGS += $(DRV_WPA_CFLAGS)
303LDFLAGS += $(DRV_WPA_LDFLAGS)
304LIBS += $(DRV_WPA_LIBS)
305endif
306
307ifndef CONFIG_L2_PACKET
308CONFIG_L2_PACKET=linux
309endif
310
311OBJS_l2 += ../src/l2_packet/l2_packet_$(CONFIG_L2_PACKET).o
312
313ifeq ($(CONFIG_L2_PACKET), pcap)
314ifdef CONFIG_WINPCAP
315CFLAGS += -DCONFIG_WINPCAP
316LIBS += -lwpcap -lpacket
317LIBS_w += -lwpcap
318else
319LIBS += -ldnet -lpcap
320endif
321endif
322
323ifeq ($(CONFIG_L2_PACKET), winpcap)
324LIBS += -lwpcap -lpacket
325LIBS_w += -lwpcap
326endif
327
328ifeq ($(CONFIG_L2_PACKET), freebsd)
329LIBS += -lpcap
330endif
331
332ifdef CONFIG_EAP_TLS
333# EAP-TLS
334ifeq ($(CONFIG_EAP_TLS), dyn)
335CFLAGS += -DEAP_TLS_DYNAMIC
336EAPDYN += ../src/eap_peer/eap_tls.so
337else
338CFLAGS += -DEAP_TLS
339OBJS += ../src/eap_peer/eap_tls.o
340OBJS_h += ../src/eap_server/eap_server_tls.o
341endif
342TLS_FUNCS=y
343CONFIG_IEEE8021X_EAPOL=y
344endif
345
346ifdef CONFIG_EAP_UNAUTH_TLS
347# EAP-UNAUTH-TLS
348CFLAGS += -DEAP_UNAUTH_TLS
349ifndef CONFIG_EAP_UNAUTH_TLS
350OBJS += ../src/eap_peer/eap_tls.o
351OBJS_h += ../src/eap_server/eap_server_tls.o
352TLS_FUNCS=y
353endif
354CONFIG_IEEE8021X_EAPOL=y
355endif
356
357ifdef CONFIG_EAP_PEAP
358# EAP-PEAP
359ifeq ($(CONFIG_EAP_PEAP), dyn)
360CFLAGS += -DEAP_PEAP_DYNAMIC
361EAPDYN += ../src/eap_peer/eap_peap.so
362else
363CFLAGS += -DEAP_PEAP
364OBJS += ../src/eap_peer/eap_peap.o
365OBJS += ../src/eap_common/eap_peap_common.o
366OBJS_h += ../src/eap_server/eap_server_peap.o
367endif
368TLS_FUNCS=y
369CONFIG_IEEE8021X_EAPOL=y
370endif
371
372ifdef CONFIG_EAP_TTLS
373# EAP-TTLS
374ifeq ($(CONFIG_EAP_TTLS), dyn)
375CFLAGS += -DEAP_TTLS_DYNAMIC
376EAPDYN += ../src/eap_peer/eap_ttls.so
377else
378CFLAGS += -DEAP_TTLS
379OBJS += ../src/eap_peer/eap_ttls.o
380OBJS_h += ../src/eap_server/eap_server_ttls.o
381endif
382MS_FUNCS=y
383TLS_FUNCS=y
384CHAP=y
385CONFIG_IEEE8021X_EAPOL=y
386endif
387
388ifdef CONFIG_EAP_MD5
389# EAP-MD5
390ifeq ($(CONFIG_EAP_MD5), dyn)
391CFLAGS += -DEAP_MD5_DYNAMIC
392EAPDYN += ../src/eap_peer/eap_md5.so
393else
394CFLAGS += -DEAP_MD5
395OBJS += ../src/eap_peer/eap_md5.o
396OBJS_h += ../src/eap_server/eap_server_md5.o
397endif
398CHAP=y
399CONFIG_IEEE8021X_EAPOL=y
400endif
401
402# backwards compatibility for old spelling
403ifdef CONFIG_MSCHAPV2
404ifndef CONFIG_EAP_MSCHAPV2
405CONFIG_EAP_MSCHAPV2=y
406endif
407endif
408
409ifdef CONFIG_EAP_MSCHAPV2
410# EAP-MSCHAPv2
411ifeq ($(CONFIG_EAP_MSCHAPV2), dyn)
412CFLAGS += -DEAP_MSCHAPv2_DYNAMIC
413EAPDYN += ../src/eap_peer/eap_mschapv2.so
414EAPDYN += ../src/eap_peer/mschapv2.so
415else
416CFLAGS += -DEAP_MSCHAPv2
417OBJS += ../src/eap_peer/eap_mschapv2.o
418OBJS += ../src/eap_peer/mschapv2.o
419OBJS_h += ../src/eap_server/eap_server_mschapv2.o
420endif
421MS_FUNCS=y
422CONFIG_IEEE8021X_EAPOL=y
423endif
424
425ifdef CONFIG_EAP_GTC
426# EAP-GTC
427ifeq ($(CONFIG_EAP_GTC), dyn)
428CFLAGS += -DEAP_GTC_DYNAMIC
429EAPDYN += ../src/eap_peer/eap_gtc.so
430else
431CFLAGS += -DEAP_GTC
432OBJS += ../src/eap_peer/eap_gtc.o
433OBJS_h += ../src/eap_server/eap_server_gtc.o
434endif
435CONFIG_IEEE8021X_EAPOL=y
436endif
437
438ifdef CONFIG_EAP_OTP
439# EAP-OTP
440ifeq ($(CONFIG_EAP_OTP), dyn)
441CFLAGS += -DEAP_OTP_DYNAMIC
442EAPDYN += ../src/eap_peer/eap_otp.so
443else
444CFLAGS += -DEAP_OTP
445OBJS += ../src/eap_peer/eap_otp.o
446endif
447CONFIG_IEEE8021X_EAPOL=y
448endif
449
450ifdef CONFIG_EAP_SIM
451# EAP-SIM
452ifeq ($(CONFIG_EAP_SIM), dyn)
453CFLAGS += -DEAP_SIM_DYNAMIC
454EAPDYN += ../src/eap_peer/eap_sim.so
455else
456CFLAGS += -DEAP_SIM
457OBJS += ../src/eap_peer/eap_sim.o
458OBJS_h += ../src/eap_server/eap_server_sim.o
459endif
460CONFIG_IEEE8021X_EAPOL=y
461CONFIG_EAP_SIM_COMMON=y
462NEED_AES_CBC=y
463endif
464
465ifdef CONFIG_EAP_LEAP
466# EAP-LEAP
467ifeq ($(CONFIG_EAP_LEAP), dyn)
468CFLAGS += -DEAP_LEAP_DYNAMIC
469EAPDYN += ../src/eap_peer/eap_leap.so
470else
471CFLAGS += -DEAP_LEAP
472OBJS += ../src/eap_peer/eap_leap.o
473endif
474MS_FUNCS=y
475CONFIG_IEEE8021X_EAPOL=y
476endif
477
478ifdef CONFIG_EAP_PSK
479# EAP-PSK
480ifeq ($(CONFIG_EAP_PSK), dyn)
481CFLAGS += -DEAP_PSK_DYNAMIC
482EAPDYN += ../src/eap_peer/eap_psk.so
483else
484CFLAGS += -DEAP_PSK
485OBJS += ../src/eap_peer/eap_psk.o ../src/eap_common/eap_psk_common.o
486OBJS_h += ../src/eap_server/eap_server_psk.o
487endif
488CONFIG_IEEE8021X_EAPOL=y
489NEED_AES=y
490NEED_AES_OMAC1=y
491NEED_AES_ENCBLOCK=y
492NEED_AES_EAX=y
493endif
494
495ifdef CONFIG_EAP_AKA
496# EAP-AKA
497ifeq ($(CONFIG_EAP_AKA), dyn)
498CFLAGS += -DEAP_AKA_DYNAMIC
499EAPDYN += ../src/eap_peer/eap_aka.so
500else
501CFLAGS += -DEAP_AKA
502OBJS += ../src/eap_peer/eap_aka.o
503OBJS_h += ../src/eap_server/eap_server_aka.o
504endif
505CONFIG_IEEE8021X_EAPOL=y
506CONFIG_EAP_SIM_COMMON=y
507NEED_AES_CBC=y
508endif
509
510ifdef CONFIG_EAP_PROXY
511CFLAGS += -DCONFIG_EAP_PROXY
512OBJS += ../src/eap_peer/eap_proxy_$(CONFIG_EAP_PROXY).o
513include eap_proxy_$(CONFIG_EAP_PROXY).mak
514CONFIG_IEEE8021X_EAPOL=y
515endif
516
517ifdef CONFIG_EAP_AKA_PRIME
518# EAP-AKA'
519ifeq ($(CONFIG_EAP_AKA_PRIME), dyn)
520CFLAGS += -DEAP_AKA_PRIME_DYNAMIC
521else
522CFLAGS += -DEAP_AKA_PRIME
523endif
524NEED_SHA256=y
525endif
526
527ifdef CONFIG_EAP_SIM_COMMON
528OBJS += ../src/eap_common/eap_sim_common.o
529OBJS_h += ../src/eap_server/eap_sim_db.o
530NEED_AES=y
531NEED_FIPS186_2_PRF=y
532endif
533
534ifdef CONFIG_EAP_FAST
535# EAP-FAST
536ifeq ($(CONFIG_EAP_FAST), dyn)
537CFLAGS += -DEAP_FAST_DYNAMIC
538EAPDYN += ../src/eap_peer/eap_fast.so
539EAPDYN += ../src/eap_common/eap_fast_common.o
540else
541CFLAGS += -DEAP_FAST
542OBJS += ../src/eap_peer/eap_fast.o ../src/eap_peer/eap_fast_pac.o
543OBJS += ../src/eap_common/eap_fast_common.o
544OBJS_h += ../src/eap_server/eap_server_fast.o
545endif
546TLS_FUNCS=y
547CONFIG_IEEE8021X_EAPOL=y
548NEED_T_PRF=y
549endif
550
551ifdef CONFIG_EAP_PAX
552# EAP-PAX
553ifeq ($(CONFIG_EAP_PAX), dyn)
554CFLAGS += -DEAP_PAX_DYNAMIC
555EAPDYN += ../src/eap_peer/eap_pax.so
556else
557CFLAGS += -DEAP_PAX
558OBJS += ../src/eap_peer/eap_pax.o ../src/eap_common/eap_pax_common.o
559OBJS_h += ../src/eap_server/eap_server_pax.o
560endif
561CONFIG_IEEE8021X_EAPOL=y
562endif
563
564ifdef CONFIG_EAP_SAKE
565# EAP-SAKE
566ifeq ($(CONFIG_EAP_SAKE), dyn)
567CFLAGS += -DEAP_SAKE_DYNAMIC
568EAPDYN += ../src/eap_peer/eap_sake.so
569else
570CFLAGS += -DEAP_SAKE
571OBJS += ../src/eap_peer/eap_sake.o ../src/eap_common/eap_sake_common.o
572OBJS_h += ../src/eap_server/eap_server_sake.o
573endif
574CONFIG_IEEE8021X_EAPOL=y
575endif
576
577ifdef CONFIG_EAP_GPSK
578# EAP-GPSK
579ifeq ($(CONFIG_EAP_GPSK), dyn)
580CFLAGS += -DEAP_GPSK_DYNAMIC
581EAPDYN += ../src/eap_peer/eap_gpsk.so
582else
583CFLAGS += -DEAP_GPSK
584OBJS += ../src/eap_peer/eap_gpsk.o ../src/eap_common/eap_gpsk_common.o
585OBJS_h += ../src/eap_server/eap_server_gpsk.o
586endif
587CONFIG_IEEE8021X_EAPOL=y
588ifdef CONFIG_EAP_GPSK_SHA256
589CFLAGS += -DEAP_GPSK_SHA256
590endif
591NEED_SHA256=y
592NEED_AES_OMAC1=y
593endif
594
595ifdef CONFIG_EAP_PWD
596CFLAGS += -DEAP_PWD
597OBJS += ../src/eap_peer/eap_pwd.o ../src/eap_common/eap_pwd_common.o
598OBJS_h += ../src/eap_server/eap_server_pwd.o
599CONFIG_IEEE8021X_EAPOL=y
600NEED_SHA256=y
601endif
602
603ifdef CONFIG_EAP_EKE
604# EAP-EKE
605ifeq ($(CONFIG_EAP_EKE), dyn)
606CFLAGS += -DEAP_EKE_DYNAMIC
607EAPDYN += ../src/eap_peer/eap_eke.so
608else
609CFLAGS += -DEAP_EKE
610OBJS += ../src/eap_peer/eap_eke.o ../src/eap_common/eap_eke_common.o
611OBJS_h += ../src/eap_server/eap_server_eke.o
612endif
613CONFIG_IEEE8021X_EAPOL=y
614NEED_DH_GROUPS=y
615NEED_DH_GROUPS_ALL=y
616NEED_SHA256=y
617endif
618
619ifdef CONFIG_WPS
620# EAP-WSC
621CFLAGS += -DCONFIG_WPS -DEAP_WSC
622OBJS += wps_supplicant.o
623OBJS += ../src/utils/uuid.o
624OBJS += ../src/eap_peer/eap_wsc.o ../src/eap_common/eap_wsc_common.o
625OBJS += ../src/wps/wps.o
626OBJS += ../src/wps/wps_common.o
627OBJS += ../src/wps/wps_attr_parse.o
628OBJS += ../src/wps/wps_attr_build.o
629OBJS += ../src/wps/wps_attr_process.o
630OBJS += ../src/wps/wps_dev_attr.o
631OBJS += ../src/wps/wps_enrollee.o
632OBJS += ../src/wps/wps_registrar.o
633OBJS_h += ../src/eap_server/eap_server_wsc.o
634CONFIG_IEEE8021X_EAPOL=y
635NEED_DH_GROUPS=y
636NEED_SHA256=y
637NEED_BASE64=y
638NEED_80211_COMMON=y
639NEED_AES_CBC=y
640NEED_MODEXP=y
641
642ifdef CONFIG_WPS_NFC
643CFLAGS += -DCONFIG_WPS_NFC
644OBJS += ../src/wps/ndef.o
645NEED_WPS_OOB=y
646endif
647
648ifdef NEED_WPS_OOB
649CFLAGS += -DCONFIG_WPS_OOB
650endif
651
652ifdef CONFIG_WPS_ER
653CONFIG_WPS_UPNP=y
654CFLAGS += -DCONFIG_WPS_ER
655OBJS += ../src/wps/wps_er.o
656OBJS += ../src/wps/wps_er_ssdp.o
657endif
658
659ifdef CONFIG_WPS_UPNP
660CFLAGS += -DCONFIG_WPS_UPNP
661OBJS += ../src/wps/wps_upnp.o
662OBJS += ../src/wps/wps_upnp_ssdp.o
663OBJS += ../src/wps/wps_upnp_web.o
664OBJS += ../src/wps/wps_upnp_event.o
665OBJS += ../src/wps/wps_upnp_ap.o
666OBJS += ../src/wps/upnp_xml.o
667OBJS += ../src/wps/httpread.o
668OBJS += ../src/wps/http_client.o
669OBJS += ../src/wps/http_server.o
670endif
671
672ifdef CONFIG_WPS_STRICT
673CFLAGS += -DCONFIG_WPS_STRICT
674OBJS += ../src/wps/wps_validate.o
675endif
676
677ifdef CONFIG_WPS_TESTING
678CFLAGS += -DCONFIG_WPS_TESTING
679endif
680
681ifdef CONFIG_WPS_REG_DISABLE_OPEN
682CFLAGS += -DCONFIG_WPS_REG_DISABLE_OPEN
683endif
684
685endif
686
687ifdef CONFIG_EAP_IKEV2
688# EAP-IKEv2
689ifeq ($(CONFIG_EAP_IKEV2), dyn)
690CFLAGS += -DEAP_IKEV2_DYNAMIC
691EAPDYN += ../src/eap_peer/eap_ikev2.so ../src/eap_peer/ikev2.o
692EAPDYN += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
693else
694CFLAGS += -DEAP_IKEV2
695OBJS += ../src/eap_peer/eap_ikev2.o ../src/eap_peer/ikev2.o
696OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
697OBJS_h += ../src/eap_server/eap_server_ikev2.o
698OBJS_h += ../src/eap_server/ikev2.o
699endif
700CONFIG_IEEE8021X_EAPOL=y
701NEED_DH_GROUPS=y
702NEED_DH_GROUPS_ALL=y
703NEED_MODEXP=y
704NEED_CIPHER=y
705endif
706
707ifdef CONFIG_EAP_VENDOR_TEST
708ifeq ($(CONFIG_EAP_VENDOR_TEST), dyn)
709CFLAGS += -DEAP_VENDOR_TEST_DYNAMIC
710EAPDYN += ../src/eap_peer/eap_vendor_test.so
711else
712CFLAGS += -DEAP_VENDOR_TEST
713OBJS += ../src/eap_peer/eap_vendor_test.o
714OBJS_h += ../src/eap_server/eap_server_vendor_test.o
715endif
716CONFIG_IEEE8021X_EAPOL=y
717endif
718
719ifdef CONFIG_EAP_TNC
720# EAP-TNC
721CFLAGS += -DEAP_TNC
722OBJS += ../src/eap_peer/eap_tnc.o
723OBJS += ../src/eap_peer/tncc.o
724OBJS_h += ../src/eap_server/eap_server_tnc.o
725OBJS_h += ../src/eap_server/tncs.o
726NEED_BASE64=y
727ifndef CONFIG_NATIVE_WINDOWS
728ifndef CONFIG_DRIVER_BSD
729LIBS += -ldl
730endif
731endif
732endif
733
734ifdef CONFIG_IEEE8021X_EAPOL
735# IEEE 802.1X/EAPOL state machines (e.g., for RADIUS authentication)
736CFLAGS += -DIEEE8021X_EAPOL
737OBJS += ../src/eapol_supp/eapol_supp_sm.o
738OBJS += ../src/eap_peer/eap.o ../src/eap_peer/eap_methods.o
739NEED_EAP_COMMON=y
740ifdef CONFIG_DYNAMIC_EAP_METHODS
741CFLAGS += -DCONFIG_DYNAMIC_EAP_METHODS
742LIBS += -ldl -rdynamic
743endif
744endif
745
746ifdef CONFIG_MACSEC
747CFLAGS += -DCONFIG_MACSEC
748NEED_AES_ENCBLOCK=y
749NEED_AES_UNWRAP=y
750NEED_AES_WRAP=y
751NEED_AES_OMAC1=y
752OBJS += wpas_kay.o
753OBJS += ../src/pae/ieee802_1x_cp.o
754OBJS += ../src/pae/ieee802_1x_kay.o
755OBJS += ../src/pae/ieee802_1x_key.o
756OBJS += ../src/pae/ieee802_1x_secy_ops.o
757endif
758
759ifdef CONFIG_AP
760NEED_80211_COMMON=y
761NEED_EAP_COMMON=y
762NEED_RSN_AUTHENTICATOR=y
763CFLAGS += -DCONFIG_AP
764OBJS += ap.o
765CFLAGS += -DCONFIG_NO_RADIUS
766CFLAGS += -DCONFIG_NO_ACCOUNTING
767CFLAGS += -DCONFIG_NO_VLAN
768OBJS += ../src/ap/hostapd.o
769OBJS += ../src/ap/wpa_auth_glue.o
770OBJS += ../src/ap/utils.o
771OBJS += ../src/ap/authsrv.o
772OBJS += ../src/ap/ap_config.o
773OBJS += ../src/utils/ip_addr.o
774OBJS += ../src/ap/sta_info.o
775OBJS += ../src/ap/tkip_countermeasures.o
776OBJS += ../src/ap/ap_mlme.o
777OBJS += ../src/ap/ieee802_1x.o
778OBJS += ../src/eapol_auth/eapol_auth_sm.o
779OBJS += ../src/ap/ieee802_11_auth.o
780OBJS += ../src/ap/ieee802_11_shared.o
781OBJS += ../src/ap/drv_callbacks.o
782OBJS += ../src/ap/ap_drv_ops.o
783OBJS += ../src/ap/beacon.o
784OBJS += ../src/ap/eap_user_db.o
785ifdef CONFIG_IEEE80211N
786OBJS += ../src/ap/ieee802_11_ht.o
787ifdef CONFIG_IEEE80211AC
788OBJS += ../src/ap/ieee802_11_vht.o
789endif
790endif
791ifdef CONFIG_WNM
792OBJS += ../src/ap/wnm_ap.o
793endif
794ifdef CONFIG_CTRL_IFACE
795OBJS += ../src/ap/ctrl_iface_ap.o
796endif
797
798CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
799OBJS += ../src/eap_server/eap_server.o
800OBJS += ../src/eap_server/eap_server_identity.o
801OBJS += ../src/eap_server/eap_server_methods.o
802
803ifdef CONFIG_IEEE80211N
804CFLAGS += -DCONFIG_IEEE80211N
805ifdef CONFIG_IEEE80211AC
806CFLAGS += -DCONFIG_IEEE80211AC
807endif
808endif
809
810ifdef NEED_AP_MLME
811OBJS += ../src/ap/wmm.o
812OBJS += ../src/ap/ap_list.o
813OBJS += ../src/ap/ieee802_11.o
814OBJS += ../src/ap/hw_features.o
815OBJS += ../src/ap/dfs.o
816CFLAGS += -DNEED_AP_MLME
817endif
818ifdef CONFIG_WPS
819CFLAGS += -DEAP_SERVER_WSC
820OBJS += ../src/ap/wps_hostapd.o
821OBJS += ../src/eap_server/eap_server_wsc.o
822endif
823ifdef CONFIG_INTERWORKING
824OBJS += ../src/ap/gas_serv.o
825endif
826ifdef CONFIG_HS20
827OBJS += ../src/ap/hs20.o
828endif
829endif
830
831ifdef NEED_RSN_AUTHENTICATOR
832CFLAGS += -DCONFIG_NO_RADIUS
833NEED_AES_WRAP=y
834OBJS += ../src/ap/wpa_auth.o
835OBJS += ../src/ap/wpa_auth_ie.o
836OBJS += ../src/ap/pmksa_cache_auth.o
837ifdef CONFIG_IEEE80211R
838OBJS += ../src/ap/wpa_auth_ft.o
839endif
840ifdef CONFIG_PEERKEY
841OBJS += ../src/ap/peerkey_auth.o
842endif
843endif
844
845ifdef CONFIG_EAP_SERVER
846CFLAGS += -DEAP_SERVER
847OBJS_h += ../src/eap_server/eap_server.o
848OBJS_h += ../src/eap_server/eap_server_identity.o
849OBJS_h += ../src/eap_server/eap_server_methods.o
850endif
851
852ifdef CONFIG_RADIUS_CLIENT
853OBJS_h += ../src/utils/ip_addr.o
854OBJS_h += ../src/radius/radius.o
855OBJS_h += ../src/radius/radius_client.o
856endif
857
858ifdef CONFIG_AUTHENTICATOR
859OBJS_h += ../src/eapol_auth/eapol_auth_sm.o
860OBJS_h += ../src/ap/ieee802_1x.o
861endif
862
863ifdef CONFIG_WPA_AUTHENTICATOR
864OBJS_h += ../src/ap/wpa_auth.o
865OBJS_h += ../src/ap/wpa_auth_ie.o
866OBJS_h += ../src/ap/pmksa_cache_auth.o
867ifdef CONFIG_IEEE80211R
868OBJS_h += ../src/ap/wpa_auth_ft.o
869endif
870ifdef CONFIG_PEERKEY
871OBJS_h += ../src/ap/peerkey_auth.o
872endif
873endif
874
875ifdef CONFIG_PCSC
876# PC/SC interface for smartcards (USIM, GSM SIM)
877CFLAGS += -DPCSC_FUNCS -I/usr/include/PCSC
878OBJS += ../src/utils/pcsc_funcs.o
879# -lpthread may not be needed depending on how pcsc-lite was configured
880ifdef CONFIG_NATIVE_WINDOWS
881#Once MinGW gets support for WinScard, -lwinscard could be used instead of the
882#dynamic symbol loading that is now used in pcsc_funcs.c
883#LIBS += -lwinscard
884else
885LIBS += -lpcsclite -lpthread
886endif
887endif
888
889ifdef CONFIG_SIM_SIMULATOR
890CFLAGS += -DCONFIG_SIM_SIMULATOR
891NEED_MILENAGE=y
892endif
893
894ifdef CONFIG_USIM_SIMULATOR
895CFLAGS += -DCONFIG_USIM_SIMULATOR
896NEED_MILENAGE=y
897endif
898
899ifdef NEED_MILENAGE
900OBJS += ../src/crypto/milenage.o
901NEED_AES_ENCBLOCK=y
902endif
903
904ifdef CONFIG_PKCS12
905CFLAGS += -DPKCS12_FUNCS
906endif
907
908ifdef CONFIG_SMARTCARD
909CFLAGS += -DCONFIG_SMARTCARD
910endif
911
912ifdef MS_FUNCS
913OBJS += ../src/crypto/ms_funcs.o
914NEED_DES=y
915NEED_MD4=y
916endif
917
918ifdef CHAP
919OBJS += ../src/eap_common/chap.o
920endif
921
922ifdef TLS_FUNCS
923NEED_DES=y
924# Shared TLS functions (needed for EAP_TLS, EAP_PEAP, EAP_TTLS, and EAP_FAST)
925OBJS += ../src/eap_peer/eap_tls_common.o
926OBJS_h += ../src/eap_server/eap_server_tls_common.o
927ifndef CONFIG_FIPS
928NEED_TLS_PRF=y
929NEED_SHA1=y
930NEED_MD5=y
931endif
932endif
933
934ifndef CONFIG_TLS
935CONFIG_TLS=openssl
936endif
937
938ifdef CONFIG_TLSV11
939CFLAGS += -DCONFIG_TLSV11
940endif
941
942ifdef CONFIG_TLSV12
943CFLAGS += -DCONFIG_TLSV12
944NEED_SHA256=y
945endif
946
947ifeq ($(CONFIG_TLS), openssl)
948ifdef TLS_FUNCS
949CFLAGS += -DEAP_TLS_OPENSSL
950OBJS += ../src/crypto/tls_openssl.o
951LIBS += -lssl
952endif
953OBJS += ../src/crypto/crypto_openssl.o
954OBJS_p += ../src/crypto/crypto_openssl.o
955ifdef NEED_FIPS186_2_PRF
956OBJS += ../src/crypto/fips_prf_openssl.o
957endif
958LIBS += -lcrypto
959LIBS_p += -lcrypto
960ifdef CONFIG_TLS_ADD_DL
961LIBS += -ldl
962LIBS_p += -ldl
963endif
964endif
965
966ifeq ($(CONFIG_TLS), gnutls)
967ifdef TLS_FUNCS
968OBJS += ../src/crypto/tls_gnutls.o
969LIBS += -lgnutls -lgpg-error
970endif
971OBJS += ../src/crypto/crypto_gnutls.o
972OBJS_p += ../src/crypto/crypto_gnutls.o
973ifdef NEED_FIPS186_2_PRF
974OBJS += ../src/crypto/fips_prf_internal.o
975SHA1OBJS += ../src/crypto/sha1-internal.o
976endif
977LIBS += -lgcrypt
978LIBS_p += -lgcrypt
979CONFIG_INTERNAL_SHA256=y
980CONFIG_INTERNAL_RC4=y
981CONFIG_INTERNAL_DH_GROUP5=y
982endif
983
984ifeq ($(CONFIG_TLS), schannel)
985ifdef TLS_FUNCS
986OBJS += ../src/crypto/tls_schannel.o
987endif
988OBJS += ../src/crypto/crypto_cryptoapi.o
989OBJS_p += ../src/crypto/crypto_cryptoapi.o
990ifdef NEED_FIPS186_2_PRF
991OBJS += ../src/crypto/fips_prf_internal.o
992SHA1OBJS += ../src/crypto/sha1-internal.o
993endif
994CONFIG_INTERNAL_SHA256=y
995CONFIG_INTERNAL_RC4=y
996CONFIG_INTERNAL_DH_GROUP5=y
997endif
998
999ifeq ($(CONFIG_TLS), nss)
1000ifdef TLS_FUNCS
1001OBJS += ../src/crypto/tls_nss.o
1002LIBS += -lssl3
1003endif
1004OBJS += ../src/crypto/crypto_nss.o
1005OBJS_p += ../src/crypto/crypto_nss.o
1006ifdef NEED_FIPS186_2_PRF
1007OBJS += ../src/crypto/fips_prf_internal.o
1008SHA1OBJS += ../src/crypto/sha1-internal.o
1009endif
1010LIBS += -lnss3
1011LIBS_p += -lnss3
1012CONFIG_INTERNAL_MD4=y
1013CONFIG_INTERNAL_DH_GROUP5=y
1014endif
1015
1016ifeq ($(CONFIG_TLS), internal)
1017ifndef CONFIG_CRYPTO
1018CONFIG_CRYPTO=internal
1019endif
1020ifdef TLS_FUNCS
1021OBJS += ../src/crypto/crypto_internal-rsa.o
1022OBJS += ../src/crypto/tls_internal.o
1023OBJS += ../src/tls/tlsv1_common.o
1024OBJS += ../src/tls/tlsv1_record.o
1025OBJS += ../src/tls/tlsv1_cred.o
1026OBJS += ../src/tls/tlsv1_client.o
1027OBJS += ../src/tls/tlsv1_client_write.o
1028OBJS += ../src/tls/tlsv1_client_read.o
1029OBJS += ../src/tls/asn1.o
1030OBJS += ../src/tls/rsa.o
1031OBJS += ../src/tls/x509v3.o
1032OBJS += ../src/tls/pkcs1.o
1033OBJS += ../src/tls/pkcs5.o
1034OBJS += ../src/tls/pkcs8.o
1035NEED_SHA256=y
1036NEED_BASE64=y
1037NEED_TLS_PRF=y
1038ifdef CONFIG_TLSV12
1039NEED_TLS_PRF_SHA256=y
1040endif
1041NEED_MODEXP=y
1042NEED_CIPHER=y
1043CFLAGS += -DCONFIG_TLS_INTERNAL_CLIENT
1044endif
1045ifdef NEED_CIPHER
1046NEED_DES=y
1047OBJS += ../src/crypto/crypto_internal-cipher.o
1048endif
1049ifdef NEED_MODEXP
1050OBJS += ../src/crypto/crypto_internal-modexp.o
1051OBJS += ../src/tls/bignum.o
1052endif
1053ifeq ($(CONFIG_CRYPTO), libtomcrypt)
1054OBJS += ../src/crypto/crypto_libtomcrypt.o
1055OBJS_p += ../src/crypto/crypto_libtomcrypt.o
1056LIBS += -ltomcrypt -ltfm
1057LIBS_p += -ltomcrypt -ltfm
1058CONFIG_INTERNAL_SHA256=y
1059CONFIG_INTERNAL_RC4=y
1060CONFIG_INTERNAL_DH_GROUP5=y
1061endif
1062ifeq ($(CONFIG_CRYPTO), internal)
1063OBJS += ../src/crypto/crypto_internal.o
1064OBJS_p += ../src/crypto/crypto_internal.o
1065NEED_AES_ENC=y
1066CFLAGS += -DCONFIG_CRYPTO_INTERNAL
1067ifdef CONFIG_INTERNAL_LIBTOMMATH
1068CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
1069ifdef CONFIG_INTERNAL_LIBTOMMATH_FAST
1070CFLAGS += -DLTM_FAST
1071endif
1072else
1073LIBS += -ltommath
1074LIBS_p += -ltommath
1075endif
1076CONFIG_INTERNAL_AES=y
1077CONFIG_INTERNAL_DES=y
1078CONFIG_INTERNAL_SHA1=y
1079CONFIG_INTERNAL_MD4=y
1080CONFIG_INTERNAL_MD5=y
1081CONFIG_INTERNAL_SHA256=y
1082CONFIG_INTERNAL_RC4=y
1083CONFIG_INTERNAL_DH_GROUP5=y
1084endif
1085ifeq ($(CONFIG_CRYPTO), cryptoapi)
1086OBJS += ../src/crypto/crypto_cryptoapi.o
1087OBJS_p += ../src/crypto/crypto_cryptoapi.o
1088CFLAGS += -DCONFIG_CRYPTO_CRYPTOAPI
1089CONFIG_INTERNAL_SHA256=y
1090CONFIG_INTERNAL_RC4=y
1091endif
1092endif
1093
1094ifeq ($(CONFIG_TLS), none)
1095ifdef TLS_FUNCS
1096OBJS += ../src/crypto/tls_none.o
1097CFLAGS += -DEAP_TLS_NONE
1098CONFIG_INTERNAL_AES=y
1099CONFIG_INTERNAL_SHA1=y
1100CONFIG_INTERNAL_MD5=y
1101endif
1102OBJS += ../src/crypto/crypto_none.o
1103OBJS_p += ../src/crypto/crypto_none.o
1104CONFIG_INTERNAL_SHA256=y
1105CONFIG_INTERNAL_RC4=y
1106endif
1107
1108ifdef TLS_FUNCS
1109ifdef CONFIG_SMARTCARD
1110ifndef CONFIG_NATIVE_WINDOWS
1111ifneq ($(CONFIG_L2_PACKET), freebsd)
1112LIBS += -ldl
1113endif
1114endif
1115endif
1116endif
1117
1118ifndef TLS_FUNCS
1119OBJS += ../src/crypto/tls_none.o
1120ifeq ($(CONFIG_TLS), internal)
1121CONFIG_INTERNAL_AES=y
1122CONFIG_INTERNAL_SHA1=y
1123CONFIG_INTERNAL_MD5=y
1124CONFIG_INTERNAL_RC4=y
1125endif
1126endif
1127
1128AESOBJS = # none so far (see below)
1129ifdef CONFIG_INTERNAL_AES
1130AESOBJS += ../src/crypto/aes-internal.o ../src/crypto/aes-internal-dec.o
1131endif
1132
1133AESOBJS += ../src/crypto/aes-unwrap.o
1134ifdef NEED_AES_EAX
1135AESOBJS += ../src/crypto/aes-eax.o
1136NEED_AES_CTR=y
1137endif
1138ifdef NEED_AES_CTR
1139AESOBJS += ../src/crypto/aes-ctr.o
1140endif
1141ifdef NEED_AES_ENCBLOCK
1142AESOBJS += ../src/crypto/aes-encblock.o
1143endif
1144ifdef NEED_AES_OMAC1
1145NEED_AES_ENC=y
1146ifdef CONFIG_OPENSSL_CMAC
1147CFLAGS += -DCONFIG_OPENSSL_CMAC
1148else
1149AESOBJS += ../src/crypto/aes-omac1.o
1150endif
1151endif
1152ifdef NEED_AES_WRAP
1153NEED_AES_ENC=y
1154AESOBJS += ../src/crypto/aes-wrap.o
1155endif
1156ifdef NEED_AES_CBC
1157NEED_AES_ENC=y
1158AESOBJS += ../src/crypto/aes-cbc.o
1159endif
1160ifdef NEED_AES_ENC
1161ifdef CONFIG_INTERNAL_AES
1162AESOBJS += ../src/crypto/aes-internal-enc.o
1163endif
1164endif
1165ifdef NEED_AES
1166OBJS += $(AESOBJS)
1167endif
1168
1169ifdef NEED_SHA1
1170ifneq ($(CONFIG_TLS), openssl)
1171SHA1OBJS += ../src/crypto/sha1.o
1172endif
1173SHA1OBJS += ../src/crypto/sha1-prf.o
1174ifdef CONFIG_INTERNAL_SHA1
1175SHA1OBJS += ../src/crypto/sha1-internal.o
1176ifdef NEED_FIPS186_2_PRF
1177SHA1OBJS += ../src/crypto/fips_prf_internal.o
1178endif
1179endif
1180ifdef CONFIG_NO_WPA_PASSPHRASE
1181CFLAGS += -DCONFIG_NO_PBKDF2
1182else
1183ifneq ($(CONFIG_TLS), openssl)
1184SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
1185endif
1186endif
1187ifdef NEED_T_PRF
1188SHA1OBJS += ../src/crypto/sha1-tprf.o
1189endif
1190ifdef NEED_TLS_PRF
1191SHA1OBJS += ../src/crypto/sha1-tlsprf.o
1192endif
1193endif
1194
1195ifndef CONFIG_FIPS
1196MD5OBJS += ../src/crypto/md5.o
1197endif
1198ifdef NEED_MD5
1199ifdef CONFIG_INTERNAL_MD5
1200MD5OBJS += ../src/crypto/md5-internal.o
1201endif
1202OBJS += $(MD5OBJS)
1203OBJS_p += $(MD5OBJS)
1204endif
1205
1206ifdef NEED_MD4
1207ifdef CONFIG_INTERNAL_MD4
1208OBJS += ../src/crypto/md4-internal.o
1209endif
1210endif
1211
1212DESOBJS = # none needed when not internal
1213ifdef NEED_DES
1214ifdef CONFIG_INTERNAL_DES
1215DESOBJS += ../src/crypto/des-internal.o
1216endif
1217endif
1218
1219ifdef NEED_RC4
1220ifdef CONFIG_INTERNAL_RC4
1221OBJS += ../src/crypto/rc4.o
1222endif
1223endif
1224
1225SHA256OBJS = # none by default
1226ifdef NEED_SHA256
1227CFLAGS += -DCONFIG_SHA256
1228ifneq ($(CONFIG_TLS), openssl)
1229SHA256OBJS += ../src/crypto/sha256.o
1230endif
1231SHA256OBJS += ../src/crypto/sha256-prf.o
1232ifdef CONFIG_INTERNAL_SHA256
1233SHA256OBJS += ../src/crypto/sha256-internal.o
1234endif
1235ifdef NEED_TLS_PRF_SHA256
1236SHA256OBJS += ../src/crypto/sha256-tlsprf.o
1237endif
1238OBJS += $(SHA256OBJS)
1239endif
1240
1241ifdef NEED_DH_GROUPS
1242OBJS += ../src/crypto/dh_groups.o
1243endif
1244ifdef NEED_DH_GROUPS_ALL
1245CFLAGS += -DALL_DH_GROUPS
1246endif
1247ifdef CONFIG_INTERNAL_DH_GROUP5
1248ifdef NEED_DH_GROUPS
1249OBJS += ../src/crypto/dh_group5.o
1250endif
1251endif
1252
1253ifdef NEED_ECC
1254CFLAGS += -DCONFIG_ECC
1255endif
1256
1257ifdef CONFIG_NO_RANDOM_POOL
1258CFLAGS += -DCONFIG_NO_RANDOM_POOL
1259else
1260OBJS += ../src/crypto/random.o
1261endif
1262
1263ifdef CONFIG_CTRL_IFACE
1264ifeq ($(CONFIG_CTRL_IFACE), y)
1265ifdef CONFIG_NATIVE_WINDOWS
1266CONFIG_CTRL_IFACE=named_pipe
1267else
1268CONFIG_CTRL_IFACE=unix
1269endif
1270endif
1271CFLAGS += -DCONFIG_CTRL_IFACE
1272ifeq ($(CONFIG_CTRL_IFACE), unix)
1273CFLAGS += -DCONFIG_CTRL_IFACE_UNIX
1274endif
1275ifeq ($(CONFIG_CTRL_IFACE), udp)
1276CFLAGS += -DCONFIG_CTRL_IFACE_UDP
1277endif
1278ifeq ($(CONFIG_CTRL_IFACE), udp6)
1279CONFIG_CTRL_IFACE=udp
1280CFLAGS += -DCONFIG_CTRL_IFACE_UDP
1281CFLAGS += -DCONFIG_CTRL_IFACE_UDP_IPV6
1282endif
1283ifeq ($(CONFIG_CTRL_IFACE), named_pipe)
1284CFLAGS += -DCONFIG_CTRL_IFACE_NAMED_PIPE
1285endif
1286ifeq ($(CONFIG_CTRL_IFACE), udp-remote)
1287CONFIG_CTRL_IFACE=udp
1288CFLAGS += -DCONFIG_CTRL_IFACE_UDP
1289CFLAGS += -DCONFIG_CTRL_IFACE_UDP_REMOTE
1290endif
1291ifeq ($(CONFIG_CTRL_IFACE), udp6-remote)
1292CONFIG_CTRL_IFACE=udp
1293CFLAGS += -DCONFIG_CTRL_IFACE_UDP
1294CFLAGS += -DCONFIG_CTRL_IFACE_UDP_REMOTE
1295CFLAGS += -DCONFIG_CTRL_IFACE_UDP_IPV6
1296endif
1297OBJS += ctrl_iface.o ctrl_iface_$(CONFIG_CTRL_IFACE).o
1298endif
1299
1300ifdef CONFIG_CTRL_IFACE_DBUS
1301DBUS=y
1302DBUS_CFLAGS += -DCONFIG_CTRL_IFACE_DBUS -DDBUS_API_SUBJECT_TO_CHANGE
1303DBUS_OBJS += dbus/dbus_old.o dbus/dbus_old_handlers.o
1304ifdef CONFIG_WPS
1305DBUS_OBJS += dbus/dbus_old_handlers_wps.o
1306endif
1307DBUS_OBJS += dbus/dbus_dict_helpers.o
1308ifndef DBUS_LIBS
1309DBUS_LIBS := $(shell $(PKG_CONFIG) --libs dbus-1)
1310endif
1311ifndef DBUS_INCLUDE
1312DBUS_INCLUDE := $(shell $(PKG_CONFIG) --cflags dbus-1)
1313endif
1314DBUS_CFLAGS += $(DBUS_INCLUDE)
1315endif
1316
1317ifdef CONFIG_CTRL_IFACE_DBUS_NEW
1318DBUS=y
1319DBUS_CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_NEW
1320DBUS_OBJS ?= dbus/dbus_dict_helpers.o
1321DBUS_OBJS += dbus/dbus_new_helpers.o
1322DBUS_OBJS += dbus/dbus_new.o dbus/dbus_new_handlers.o
1323ifdef CONFIG_WPS
1324DBUS_OBJS += dbus/dbus_new_handlers_wps.o
1325endif
1326ifdef CONFIG_P2P
1327DBUS_OBJS += dbus/dbus_new_handlers_p2p.o
1328endif
1329ifndef DBUS_LIBS
1330DBUS_LIBS := $(shell $(PKG_CONFIG) --libs dbus-1)
1331endif
1332ifndef DBUS_INCLUDE
1333DBUS_INCLUDE := $(shell $(PKG_CONFIG) --cflags dbus-1)
1334endif
1335ifdef CONFIG_CTRL_IFACE_DBUS_INTRO
1336DBUS_OBJS += dbus/dbus_new_introspect.o
1337DBUS_CFLAGS += -DCONFIG_CTRL_IFACE_DBUS_INTRO
1338endif
1339DBUS_CFLAGS += $(DBUS_INCLUDE)
1340endif
1341
1342ifdef DBUS
1343DBUS_CFLAGS += -DCONFIG_DBUS
1344DBUS_OBJS += dbus/dbus_common.o
1345endif
1346
1347OBJS += $(DBUS_OBJS)
1348CFLAGS += $(DBUS_CFLAGS)
1349LIBS += $(DBUS_LIBS)
1350
1351ifdef CONFIG_READLINE
1352OBJS_c += ../src/utils/edit_readline.o
1353LIBS_c += -lncurses -lreadline
1354else
1355ifdef CONFIG_WPA_CLI_EDIT
1356OBJS_c += ../src/utils/edit.o
1357else
1358OBJS_c += ../src/utils/edit_simple.o
1359endif
1360endif
1361
1362ifdef CONFIG_NATIVE_WINDOWS
1363CFLAGS += -DCONFIG_NATIVE_WINDOWS
1364LIBS += -lws2_32 -lgdi32 -lcrypt32
1365LIBS_c += -lws2_32
1366LIBS_p += -lws2_32 -lgdi32
1367ifeq ($(CONFIG_CRYPTO), cryptoapi)
1368LIBS_p += -lcrypt32
1369endif
1370endif
1371
1372ifdef CONFIG_NO_STDOUT_DEBUG
1373CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
1374ifndef CONFIG_CTRL_IFACE
1375CFLAGS += -DCONFIG_NO_WPA_MSG
1376endif
1377endif
1378
1379ifdef CONFIG_IPV6
1380# for eapol_test only
1381CFLAGS += -DCONFIG_IPV6
1382endif
1383
1384ifdef NEED_BASE64
1385OBJS += ../src/utils/base64.o
1386endif
1387
1388ifdef NEED_SME
1389NEED_80211_COMMON=y
1390OBJS += sme.o
1391CFLAGS += -DCONFIG_SME
1392endif
1393
1394ifdef NEED_80211_COMMON
1395OBJS += ../src/common/ieee802_11_common.o
1396endif
1397
1398ifdef NEED_EAP_COMMON
1399OBJS += ../src/eap_common/eap_common.o
1400endif
1401
1402ifndef CONFIG_MAIN
1403CONFIG_MAIN=main
1404endif
1405
1406ifdef CONFIG_DEBUG_SYSLOG
1407CFLAGS += -DCONFIG_DEBUG_SYSLOG
1408ifdef CONFIG_DEBUG_SYSLOG_FACILITY
1409CFLAGS += -DLOG_HOSTAPD="$(CONFIG_DEBUG_SYSLOG_FACILITY)"
1410endif
1411endif
1412
1413ifdef CONFIG_DEBUG_LINUX_TRACING
1414CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING
1415endif
1416
1417ifdef CONFIG_DEBUG_FILE
1418CFLAGS += -DCONFIG_DEBUG_FILE
1419endif
1420
1421ifdef CONFIG_DELAYED_MIC_ERROR_REPORT
1422CFLAGS += -DCONFIG_DELAYED_MIC_ERROR_REPORT
1423endif
1424
1425ifdef CONFIG_FIPS
1426CFLAGS += -DCONFIG_FIPS
1427ifneq ($(CONFIG_TLS), openssl)
1428$(error CONFIG_FIPS=y requires CONFIG_TLS=openssl)
1429endif
1430endif
1431
1432OBJS += $(SHA1OBJS) $(DESOBJS)
1433
1434OBJS_p += $(SHA1OBJS)
1435OBJS_p += $(SHA256OBJS)
1436
1437ifdef CONFIG_BGSCAN_SIMPLE
1438CFLAGS += -DCONFIG_BGSCAN_SIMPLE
1439OBJS += bgscan_simple.o
1440NEED_BGSCAN=y
1441endif
1442
1443ifdef CONFIG_BGSCAN_LEARN
1444CFLAGS += -DCONFIG_BGSCAN_LEARN
1445OBJS += bgscan_learn.o
1446NEED_BGSCAN=y
1447endif
1448
1449ifdef NEED_BGSCAN
1450CFLAGS += -DCONFIG_BGSCAN
1451OBJS += bgscan.o
1452endif
1453
1454ifdef CONFIG_AUTOSCAN_EXPONENTIAL
1455CFLAGS += -DCONFIG_AUTOSCAN_EXPONENTIAL
1456OBJS += autoscan_exponential.o
1457NEED_AUTOSCAN=y
1458endif
1459
1460ifdef CONFIG_AUTOSCAN_PERIODIC
1461CFLAGS += -DCONFIG_AUTOSCAN_PERIODIC
1462OBJS += autoscan_periodic.o
1463NEED_AUTOSCAN=y
1464endif
1465
1466ifdef NEED_AUTOSCAN
1467CFLAGS += -DCONFIG_AUTOSCAN
1468OBJS += autoscan.o
1469endif
1470
1471ifdef CONFIG_EXT_PASSWORD_TEST
1472OBJS += ../src/utils/ext_password_test.o
1473CFLAGS += -DCONFIG_EXT_PASSWORD_TEST
1474NEED_EXT_PASSWORD=y
1475endif
1476
1477ifdef NEED_EXT_PASSWORD
1478OBJS += ../src/utils/ext_password.o
1479CFLAGS += -DCONFIG_EXT_PASSWORD
1480endif
1481
1482ifdef NEED_GAS
1483OBJS += ../src/common/gas.o
1484OBJS += gas_query.o
1485CFLAGS += -DCONFIG_GAS
1486NEED_OFFCHANNEL=y
1487endif
1488
1489ifdef NEED_OFFCHANNEL
1490OBJS += offchannel.o
1491CFLAGS += -DCONFIG_OFFCHANNEL
1492endif
1493
1494ifdef CONFIG_MODULE_TESTS
1495CFLAGS += -DCONFIG_MODULE_TESTS
1496OBJS += wpas_module_tests.o
1497OBJS += ../src/utils/utils_module_tests.o
1498OBJS += ../src/common/common_module_tests.o
1499ifdef CONFIG_WPS
1500OBJS += ../src/wps/wps_module_tests.o
1501endif
1502ifndef CONFIG_P2P
1503OBJS += ../src/utils/bitfield.o
1504endif
1505endif
1506
1507OBJS += ../src/drivers/driver_common.o
1508OBJS_priv += ../src/drivers/driver_common.o
1509
1510OBJS_wpa_rm := ctrl_iface.o ctrl_iface_unix.o
1511OBJS_wpa := $(filter-out $(OBJS_wpa_rm),$(OBJS)) $(OBJS_h) tests/test_wpa.o
1512ifdef CONFIG_AUTHENTICATOR
1513OBJS_wpa += tests/link_test.o
1514endif
1515OBJS_wpa += $(OBJS_l2)
1516OBJS += wpa_supplicant.o events.o blacklist.o wpas_glue.o scan.o
1517OBJS_t := $(OBJS) $(OBJS_l2) eapol_test.o
1518OBJS_t += ../src/radius/radius_client.o
1519OBJS_t += ../src/radius/radius.o
1520ifndef CONFIG_AP
1521OBJS_t += ../src/utils/ip_addr.o
1522endif
1523OBJS_t2 := $(OBJS) $(OBJS_l2) preauth_test.o
1524
1525OBJS_nfc := $(OBJS) $(OBJS_l2) nfc_pw_token.o
1526OBJS_nfc += $(OBJS_d) ../src/drivers/drivers.o
1527
1528OBJS += $(CONFIG_MAIN).o
1529
1530ifdef CONFIG_PRIVSEP
1531OBJS_priv += $(OBJS_d) ../src/drivers/drivers.o
1532OBJS_priv += $(OBJS_l2)
1533OBJS_priv += ../src/utils/os_$(CONFIG_OS).o
1534OBJS_priv += ../src/utils/$(CONFIG_ELOOP).o
1535OBJS_priv += ../src/utils/common.o
1536OBJS_priv += ../src/utils/wpa_debug.o
1537OBJS_priv += ../src/utils/wpabuf.o
1538OBJS_priv += wpa_priv.o
1539ifdef CONFIG_DRIVER_NL80211
1540OBJS_priv += ../src/common/ieee802_11_common.o
1541endif
1542ifdef CONFIG_DRIVER_TEST
1543OBJS_priv += $(SHA1OBJS)
1544OBJS_priv += $(MD5OBJS)
1545ifeq ($(CONFIG_TLS), openssl)
1546OBJS_priv += ../src/crypto/crypto_openssl.o
1547endif
1548ifeq ($(CONFIG_TLS), gnutls)
1549OBJS_priv += ../src/crypto/crypto_gnutls.o
1550endif
1551ifeq ($(CONFIG_TLS), nss)
1552OBJS_priv += ../src/crypto/crypto_nss.o
1553endif
1554ifeq ($(CONFIG_TLS), internal)
1555ifeq ($(CONFIG_CRYPTO), libtomcrypt)
1556OBJS_priv += ../src/crypto/crypto_libtomcrypt.o
1557else
1558OBJS_priv += ../src/crypto/crypto_internal.o
1559endif
1560endif
1561endif # CONFIG_DRIVER_TEST
1562OBJS += ../src/l2_packet/l2_packet_privsep.o
1563OBJS += ../src/drivers/driver_privsep.o
1564EXTRA_progs += wpa_priv
1565else
1566OBJS += $(OBJS_d) ../src/drivers/drivers.o
1567OBJS += $(OBJS_l2)
1568endif
1569
1570ifdef CONFIG_NDIS_EVENTS_INTEGRATED
1571CFLAGS += -DCONFIG_NDIS_EVENTS_INTEGRATED
1572OBJS += ../src/drivers/ndis_events.o
1573EXTRALIBS += -loleaut32 -lole32 -luuid
1574ifdef PLATFORMSDKLIB
1575EXTRALIBS += $(PLATFORMSDKLIB)/WbemUuid.Lib
1576else
1577EXTRALIBS += WbemUuid.Lib
1578endif
1579endif
1580
1581ifndef LDO
1582LDO=$(CC)
1583endif
1584
1585Q=@
1586E=echo
1587ifeq ($(V), 1)
1588Q=
1589E=true
1590endif
1591
1592dynamic_eap_methods: $(EAPDYN)
1593
1594../src/drivers/build.wpa_supplicant:
1595	@if [ -f ../src/drivers/build.hostapd ]; then \
1596		$(MAKE) -C ../src/drivers clean; \
1597	fi
1598	@touch ../src/drivers/build.wpa_supplicant
1599
1600BCHECK=../src/drivers/build.wpa_supplicant
1601
1602wpa_priv: $(BCHECK) $(OBJS_priv)
1603	$(Q)$(LDO) $(LDFLAGS) -o wpa_priv $(OBJS_priv) $(LIBS)
1604	@$(E) "  LD " $@
1605
1606$(OBJS_c) $(OBJS_t) $(OBJS_t2) $(OBJS) $(BCHECK) $(EXTRA_progs): .config
1607
1608wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
1609	$(Q)$(LDO) $(LDFLAGS) -o wpa_supplicant $(OBJS) $(LIBS) $(EXTRALIBS)
1610	@$(E) "  LD " $@
1611
1612eapol_test: $(OBJS_t)
1613	$(Q)$(LDO) $(LDFLAGS) -o eapol_test $(OBJS_t) $(LIBS)
1614	@$(E) "  LD " $@
1615
1616preauth_test: $(OBJS_t2)
1617	$(Q)$(LDO) $(LDFLAGS) -o preauth_test $(OBJS_t2) $(LIBS)
1618	@$(E) "  LD " $@
1619
1620wpa_passphrase: $(OBJS_p)
1621	$(Q)$(LDO) $(LDFLAGS) -o wpa_passphrase $(OBJS_p) $(LIBS_p)
1622	@$(E) "  LD " $@
1623
1624wpa_cli: $(OBJS_c)
1625	$(Q)$(LDO) $(LDFLAGS) -o wpa_cli $(OBJS_c) $(LIBS_c)
1626	@$(E) "  LD " $@
1627
1628link_test: $(OBJS) $(OBJS_h) tests/link_test.o
1629	$(Q)$(LDO) $(LDFLAGS) -o link_test $(OBJS) $(OBJS_h) tests/link_test.o $(LIBS)
1630	@$(E) "  LD " $@
1631
1632test_wpa: $(OBJS_wpa) $(OBJS_h)
1633	$(Q)$(LDO) $(LDFLAGS) -o test_wpa $(OBJS_wpa) $(LIBS)
1634	@$(E) "  LD " $@
1635
1636nfc_pw_token: $(OBJS_nfc)
1637	$(Q)$(LDO) $(LDFLAGS) -o nfc_pw_token $(OBJS_nfc) $(LIBS)
1638	@$(E) "  LD " $@
1639
1640win_if_list: win_if_list.c
1641	$(Q)$(LDO) $(LDFLAGS) -o $@ win_if_list.c $(CFLAGS) $(LIBS_w)
1642	@$(E) "  LD " $@
1643
1644eap_psk.so: ../src/eap_peer/eap_psk.c ../src/eap_common/eap_psk_common.c
1645	$(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
1646		-Deap_peer_psk_register=eap_peer_method_dynamic_init
1647
1648eap_pax.so: ../src/eap_peer/eap_pax.c ../src/eap_common/eap_pax_common.c
1649	$(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
1650		-Deap_peer_pax_register=eap_peer_method_dynamic_init
1651
1652eap_sake.so: ../src/eap_peer/eap_sake.c ../src/eap_common/eap_sake_common.c
1653	$(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
1654		-Deap_peer_sake_register=eap_peer_method_dynamic_init
1655
1656eap_wsc.so: ../src/eap_peer/eap_wsc.c ../src/eap_common/eap_wsc_common.c ../src/wps/wps.c
1657	$(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
1658		-Deap_peer_wsc_register=eap_peer_method_dynamic_init
1659
1660eap_ikev2.so: ../src/eap_peer/eap_ikev2.c ../src/eap_peer/ikev2.c ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.c
1661	$(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
1662		-Deap_peer_ikev2_register=eap_peer_method_dynamic_init
1663
1664eap_eke.so: ../src/eap_peer/eap_eke.c ../src/eap_common/eap_eke_common.c
1665	$(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $^ \
1666		-Deap_peer_eke_register=eap_peer_method_dynamic_init
1667
1668%.so: %.c
1669	$(CC) $(LDFLAGS) -o $@ $(CFLAGS) -shared -rdynamic -fPIC $< \
1670		-D$(*F:eap_%=eap_peer_%)_register=eap_peer_method_dynamic_init
1671
1672ifdef CONFIG_CODE_COVERAGE
1673%.o: %.c
1674	@$(E) "  CC " $<
1675	$(Q)cd $(dir $@); $(CC) -c -o $(notdir $@) $(CFLAGS) $(notdir $<)
1676else
1677%.o: %.c
1678	$(Q)$(CC) -c -o $@ $(CFLAGS) $<
1679	@$(E) "  CC " $<
1680endif
1681
1682%.service: %.service.in
1683	sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
1684
1685%@.service: %.service.arg.in
1686	sed -e 's|\@BINDIR\@|$(BINDIR)|g' $< >$@
1687
1688wpa_supplicant.exe: wpa_supplicant
1689	mv -f $< $@
1690wpa_cli.exe: wpa_cli
1691	mv -f $< $@
1692wpa_passphrase.exe: wpa_passphrase
1693	mv -f $< $@
1694win_if_list.exe: win_if_list
1695	mv -f $< $@
1696eapol_test.exe: eapol_test
1697	mv -f $< $@
1698
1699WINALL=wpa_supplicant.exe wpa_cli.exe wpa_passphrase.exe win_if_list.exe
1700
1701windows-bin: $(WINALL)
1702	$(STRIP) $(WINALL)
1703
1704wpa_gui:
1705	@echo "wpa_gui has been removed - see wpa_gui-qt4 for replacement"
1706
1707wpa_gui-qt4/Makefile:
1708	qmake -o wpa_gui-qt4/Makefile wpa_gui-qt4/wpa_gui.pro 
1709
1710wpa_gui-qt4/lang/wpa_gui_de.qm: wpa_gui-qt4/lang/wpa_gui_de.ts
1711	lrelease wpa_gui-qt4/wpa_gui.pro
1712
1713wpa_gui-qt4: wpa_gui-qt4/Makefile wpa_gui-qt4/lang/wpa_gui_de.qm
1714	$(MAKE) -C wpa_gui-qt4
1715
1716TEST_EAP_SIM_COMMON_OBJS = $(SHA1OBJS) $(MD5OBJS) \
1717	../src/utils/common.o ../src/utils/os_unix.o \
1718	../src/utils/wpa_debug.o $(AESOBJS) \
1719	tests/test_eap_sim_common.o
1720test-eap_sim_common: $(TEST_EAP_SIM_COMMON_OBJS)
1721	$(LDO) $(LDFLAGS) -o $@ $(TEST_EAP_SIM_COMMON_OBJS) $(LIBS)
1722	./test-eap_sim_common
1723	rm test-eap_sim_common
1724
1725tests: test-eap_sim_common
1726
1727FIPSDIR=/usr/local/ssl/fips-2.0
1728FIPSLD=$(FIPSDIR)/bin/fipsld
1729fips:
1730	$(MAKE) CC=$(FIPSLD) FIPSLD_CC="$(CC)"
1731
1732lcov-html: wpa_supplicant.gcda
1733	lcov -c -d .. > lcov.info
1734	genhtml lcov.info --output-directory lcov-html
1735
1736clean:
1737	$(MAKE) -C ../src clean
1738	$(MAKE) -C dbus clean
1739	rm -f core *~ *.o *.d *.gcno *.gcda *.gcov
1740	rm -f eap_*.so $(ALL) $(WINALL) eapol_test preauth_test
1741	rm -f wpa_priv
1742	rm -f nfc_pw_token
1743	rm -f lcov.info
1744	rm -rf lcov-html
1745
1746-include $(OBJS:%.o=%.d)
1747