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