Makefile revision 15907098d1f67c24bb000e593e279af173cf57d7
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
379CFLAGS += -DCONFIG_WPS -DEAP_SERVER_WSC
380OBJS += ../src/utils/uuid.o
381OBJS += ../src/ap/wps_hostapd.o
382OBJS += ../src/eap_server/eap_server_wsc.o ../src/eap_common/eap_wsc_common.o
383OBJS += ../src/wps/wps.o
384OBJS += ../src/wps/wps_common.o
385OBJS += ../src/wps/wps_attr_parse.o
386OBJS += ../src/wps/wps_attr_build.o
387OBJS += ../src/wps/wps_attr_process.o
388OBJS += ../src/wps/wps_dev_attr.o
389OBJS += ../src/wps/wps_enrollee.o
390OBJS += ../src/wps/wps_registrar.o
391NEED_DH_GROUPS=y
392NEED_SHA256=y
393NEED_BASE64=y
394NEED_AES_CBC=y
395NEED_MODEXP=y
396CONFIG_EAP=y
397
398ifdef CONFIG_WPS_NFC
399CFLAGS += -DCONFIG_WPS_NFC
400OBJS += ../src/wps/ndef.o
401NEED_WPS_OOB=y
402endif
403
404ifdef NEED_WPS_OOB
405CFLAGS += -DCONFIG_WPS_OOB
406endif
407
408ifdef CONFIG_WPS_UPNP
409CFLAGS += -DCONFIG_WPS_UPNP
410OBJS += ../src/wps/wps_upnp.o
411OBJS += ../src/wps/wps_upnp_ssdp.o
412OBJS += ../src/wps/wps_upnp_web.o
413OBJS += ../src/wps/wps_upnp_event.o
414OBJS += ../src/wps/wps_upnp_ap.o
415OBJS += ../src/wps/upnp_xml.o
416OBJS += ../src/wps/httpread.o
417OBJS += ../src/wps/http_client.o
418OBJS += ../src/wps/http_server.o
419endif
420
421ifdef CONFIG_WPS_STRICT
422CFLAGS += -DCONFIG_WPS_STRICT
423OBJS += ../src/wps/wps_validate.o
424endif
425
426ifdef CONFIG_WPS_TESTING
427CFLAGS += -DCONFIG_WPS_TESTING
428endif
429
430endif
431
432ifdef CONFIG_EAP_IKEV2
433CFLAGS += -DEAP_SERVER_IKEV2
434OBJS += ../src/eap_server/eap_server_ikev2.o ../src/eap_server/ikev2.o
435OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
436NEED_DH_GROUPS=y
437NEED_DH_GROUPS_ALL=y
438NEED_MODEXP=y
439NEED_CIPHER=y
440endif
441
442ifdef CONFIG_EAP_TNC
443CFLAGS += -DEAP_SERVER_TNC
444OBJS += ../src/eap_server/eap_server_tnc.o
445OBJS += ../src/eap_server/tncs.o
446NEED_BASE64=y
447ifndef CONFIG_DRIVER_BSD
448LIBS += -ldl
449endif
450endif
451
452# Basic EAP functionality is needed for EAPOL
453OBJS += eap_register.o
454OBJS += ../src/eap_server/eap_server.o
455OBJS += ../src/eap_common/eap_common.o
456OBJS += ../src/eap_server/eap_server_methods.o
457OBJS += ../src/eap_server/eap_server_identity.o
458CFLAGS += -DEAP_SERVER_IDENTITY
459
460ifdef CONFIG_EAP
461CFLAGS += -DEAP_SERVER
462endif
463
464ifdef CONFIG_PKCS12
465CFLAGS += -DPKCS12_FUNCS
466endif
467
468ifdef MS_FUNCS
469OBJS += ../src/crypto/ms_funcs.o
470NEED_DES=y
471NEED_MD4=y
472endif
473
474ifdef CHAP
475OBJS += ../src/eap_common/chap.o
476endif
477
478ifdef TLS_FUNCS
479NEED_DES=y
480# Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
481CFLAGS += -DEAP_TLS_FUNCS
482OBJS += ../src/eap_server/eap_server_tls_common.o
483NEED_TLS_PRF=y
484endif
485
486ifndef CONFIG_TLS
487CONFIG_TLS=openssl
488endif
489
490ifdef CONFIG_TLSV11
491CFLAGS += -DCONFIG_TLSV11
492endif
493
494ifdef CONFIG_TLSV12
495CFLAGS += -DCONFIG_TLSV12
496NEED_SHA256=y
497endif
498
499ifeq ($(CONFIG_TLS), openssl)
500ifdef TLS_FUNCS
501OBJS += ../src/crypto/tls_openssl.o
502LIBS += -lssl
503endif
504OBJS += ../src/crypto/crypto_openssl.o
505HOBJS += ../src/crypto/crypto_openssl.o
506ifdef NEED_FIPS186_2_PRF
507OBJS += ../src/crypto/fips_prf_openssl.o
508endif
509LIBS += -lcrypto
510LIBS_h += -lcrypto
511endif
512
513ifeq ($(CONFIG_TLS), gnutls)
514ifdef TLS_FUNCS
515OBJS += ../src/crypto/tls_gnutls.o
516LIBS += -lgnutls -lgpg-error
517endif
518OBJS += ../src/crypto/crypto_gnutls.o
519HOBJS += ../src/crypto/crypto_gnutls.o
520ifdef NEED_FIPS186_2_PRF
521OBJS += ../src/crypto/fips_prf_internal.o
522SHA1OBJS += ../src/crypto/sha1-internal.o
523endif
524LIBS += -lgcrypt
525LIBS_h += -lgcrypt
526CONFIG_INTERNAL_SHA256=y
527CONFIG_INTERNAL_RC4=y
528CONFIG_INTERNAL_DH_GROUP5=y
529endif
530
531ifeq ($(CONFIG_TLS), schannel)
532ifdef TLS_FUNCS
533OBJS += ../src/crypto/tls_schannel.o
534endif
535OBJS += ../src/crypto/crypto_cryptoapi.o
536OBJS_p += ../src/crypto/crypto_cryptoapi.o
537CONFIG_INTERNAL_SHA256=y
538CONFIG_INTERNAL_RC4=y
539CONFIG_INTERNAL_DH_GROUP5=y
540endif
541
542ifeq ($(CONFIG_TLS), nss)
543ifdef TLS_FUNCS
544OBJS += ../src/crypto/tls_nss.o
545LIBS += -lssl3
546endif
547OBJS += ../src/crypto/crypto_nss.o
548ifdef NEED_FIPS186_2_PRF
549OBJS += ../src/crypto/fips_prf_internal.o
550SHA1OBJS += ../src/crypto/sha1-internal.o
551endif
552LIBS += -lnss3
553LIBS_h += -lnss3
554CONFIG_INTERNAL_MD4=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
664AESOBJS += ../src/crypto/aes-wrap.o
665ifdef NEED_AES_EAX
666AESOBJS += ../src/crypto/aes-eax.o
667NEED_AES_CTR=y
668endif
669ifdef NEED_AES_CTR
670AESOBJS += ../src/crypto/aes-ctr.o
671endif
672ifdef NEED_AES_ENCBLOCK
673AESOBJS += ../src/crypto/aes-encblock.o
674endif
675ifdef NEED_AES_OMAC1
676AESOBJS += ../src/crypto/aes-omac1.o
677endif
678ifdef NEED_AES_UNWRAP
679NEED_AES_DEC=y
680AESOBJS += ../src/crypto/aes-unwrap.o
681endif
682ifdef NEED_AES_CBC
683NEED_AES_DEC=y
684AESOBJS += ../src/crypto/aes-cbc.o
685endif
686ifdef NEED_AES_DEC
687ifdef CONFIG_INTERNAL_AES
688AESOBJS += ../src/crypto/aes-internal-dec.o
689endif
690endif
691ifdef NEED_AES
692OBJS += $(AESOBJS)
693endif
694
695ifdef NEED_SHA1
696ifneq ($(CONFIG_TLS), openssl)
697SHA1OBJS += ../src/crypto/sha1.o
698endif
699SHA1OBJS += ../src/crypto/sha1-prf.o
700ifdef CONFIG_INTERNAL_SHA1
701SHA1OBJS += ../src/crypto/sha1-internal.o
702ifdef NEED_FIPS186_2_PRF
703SHA1OBJS += ../src/crypto/fips_prf_internal.o
704endif
705endif
706ifneq ($(CONFIG_TLS), openssl)
707SHA1OBJS += ../src/crypto/sha1-pbkdf2.o
708endif
709ifdef NEED_T_PRF
710SHA1OBJS += ../src/crypto/sha1-tprf.o
711endif
712ifdef NEED_TLS_PRF
713SHA1OBJS += ../src/crypto/sha1-tlsprf.o
714endif
715endif
716
717ifdef NEED_SHA1
718OBJS += $(SHA1OBJS)
719endif
720
721ifdef NEED_MD5
722ifdef CONFIG_INTERNAL_MD5
723OBJS += ../src/crypto/md5-internal.o
724HOBJS += ../src/crypto/md5-internal.o
725endif
726endif
727
728ifdef NEED_MD4
729ifdef CONFIG_INTERNAL_MD4
730OBJS += ../src/crypto/md4-internal.o
731endif
732endif
733
734ifdef NEED_DES
735ifdef CONFIG_INTERNAL_DES
736OBJS += ../src/crypto/des-internal.o
737endif
738endif
739
740ifdef NEED_RC4
741ifdef CONFIG_INTERNAL_RC4
742OBJS += ../src/crypto/rc4.o
743endif
744endif
745
746ifdef NEED_SHA256
747CFLAGS += -DCONFIG_SHA256
748ifneq ($(CONFIG_TLS), openssl)
749OBJS += ../src/crypto/sha256.o
750endif
751OBJS += ../src/crypto/sha256-prf.o
752ifdef CONFIG_INTERNAL_SHA256
753OBJS += ../src/crypto/sha256-internal.o
754endif
755ifdef NEED_TLS_PRF_SHA256
756OBJS += ../src/crypto/sha256-tlsprf.o
757endif
758endif
759
760ifdef NEED_DH_GROUPS
761OBJS += ../src/crypto/dh_groups.o
762endif
763ifdef NEED_DH_GROUPS_ALL
764CFLAGS += -DALL_DH_GROUPS
765endif
766ifdef CONFIG_INTERNAL_DH_GROUP5
767ifdef NEED_DH_GROUPS
768OBJS += ../src/crypto/dh_group5.o
769endif
770endif
771
772ifdef NEED_ECC
773CFLAGS += -DCONFIG_ECC
774endif
775
776ifdef CONFIG_NO_RANDOM_POOL
777CFLAGS += -DCONFIG_NO_RANDOM_POOL
778else
779OBJS += ../src/crypto/random.o
780HOBJS += ../src/crypto/random.o
781HOBJS += ../src/utils/eloop.o
782HOBJS += $(SHA1OBJS)
783HOBJS += ../src/crypto/md5.o
784endif
785
786ifdef CONFIG_RADIUS_SERVER
787CFLAGS += -DRADIUS_SERVER
788OBJS += ../src/radius/radius_server.o
789endif
790
791ifdef CONFIG_IPV6
792CFLAGS += -DCONFIG_IPV6
793endif
794
795ifdef CONFIG_DRIVER_RADIUS_ACL
796CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
797endif
798
799ifdef CONFIG_FULL_DYNAMIC_VLAN
800# define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
801# and vlan interfaces for the vlan feature.
802CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
803endif
804
805ifdef NEED_BASE64
806OBJS += ../src/utils/base64.o
807endif
808
809ifdef NEED_AP_MLME
810OBJS += ../src/ap/wmm.o
811OBJS += ../src/ap/ap_list.o
812OBJS += ../src/ap/ieee802_11.o
813OBJS += ../src/ap/hw_features.o
814OBJS += ../src/ap/dfs.o
815CFLAGS += -DNEED_AP_MLME
816endif
817ifdef CONFIG_IEEE80211N
818OBJS += ../src/ap/ieee802_11_ht.o
819endif
820
821ifdef CONFIG_IEEE80211AC
822OBJS += ../src/ap/ieee802_11_vht.o
823endif
824
825ifdef CONFIG_P2P_MANAGER
826CFLAGS += -DCONFIG_P2P_MANAGER
827OBJS += ../src/ap/p2p_hostapd.o
828endif
829
830ifdef CONFIG_HS20
831CFLAGS += -DCONFIG_HS20
832OBJS += ../src/ap/hs20.o
833CONFIG_INTERWORKING=y
834endif
835
836ifdef CONFIG_INTERWORKING
837CFLAGS += -DCONFIG_INTERWORKING
838OBJS += ../src/common/gas.o
839OBJS += ../src/ap/gas_serv.o
840endif
841
842OBJS += ../src/drivers/driver_common.o
843
844ifdef CONFIG_WPA_CLI_EDIT
845OBJS_c += ../src/utils/edit.o
846else
847OBJS_c += ../src/utils/edit_simple.o
848endif
849
850ifdef CONFIG_ACS
851CFLAGS += -DCONFIG_ACS
852OBJS += ../src/ap/acs.o
853LIBS += -lm
854endif
855
856ifdef CONFIG_NO_STDOUT_DEBUG
857CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
858endif
859
860ifdef CONFIG_DEBUG_LINUX_TRACING
861CFLAGS += -DCONFIG_DEBUG_LINUX_TRACING
862endif
863
864ifdef CONFIG_DEBUG_FILE
865CFLAGS += -DCONFIG_DEBUG_FILE
866endif
867
868ifdef CONFIG_SQLITE
869CFLAGS += -DCONFIG_SQLITE
870LIBS += -lsqlite3
871LIBS_h += -lsqlite3
872endif
873
874ALL=hostapd hostapd_cli
875
876all: verify_config $(ALL)
877
878Q=@
879E=echo
880ifeq ($(V), 1)
881Q=
882E=true
883endif
884
885ifdef CONFIG_CODE_COVERAGE
886%.o: %.c
887	@$(E) "  CC " $<
888	$(Q)cd $(dir $@); $(CC) -c -o $(notdir $@) $(CFLAGS) $(notdir $<)
889else
890%.o: %.c
891	$(Q)$(CC) -c -o $@ $(CFLAGS) $<
892	@$(E) "  CC " $<
893endif
894
895verify_config:
896	@if [ ! -r .config ]; then \
897		echo 'Building hostapd requires a configuration file'; \
898		echo '(.config). See README for more instructions. You can'; \
899		echo 'run "cp defconfig .config" to create an example'; \
900		echo 'configuration.'; \
901		exit 1; \
902	fi
903
904install: all
905	mkdir -p $(DESTDIR)/usr/local/bin
906	for i in $(ALL); do cp -f $$i $(DESTDIR)/usr/local/bin/$$i; done
907
908../src/drivers/build.hostapd:
909	@if [ -f ../src/drivers/build.wpa_supplicant ]; then \
910		$(MAKE) -C ../src/drivers clean; \
911	fi
912	@touch ../src/drivers/build.hostapd
913
914BCHECK=../src/drivers/build.hostapd
915
916hostapd: $(BCHECK) $(OBJS)
917	$(Q)$(CC) $(LDFLAGS) -o hostapd $(OBJS) $(LIBS)
918	@$(E) "  LD " $@
919
920ifdef CONFIG_WPA_TRACE
921OBJS_c += ../src/utils/trace.o
922endif
923hostapd_cli: $(OBJS_c)
924	$(Q)$(CC) $(LDFLAGS) -o hostapd_cli $(OBJS_c) $(LIBS_c)
925	@$(E) "  LD " $@
926
927NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS) ../src/crypto/md5.o
928ifdef NEED_RC4
929ifdef CONFIG_INTERNAL_RC4
930NOBJS += ../src/crypto/rc4.o
931endif
932endif
933ifdef CONFIG_INTERNAL_MD5
934NOBJS += ../src/crypto/md5-internal.o
935endif
936NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o
937NOBJS += ../src/utils/wpa_debug.o
938NOBJS += ../src/utils/wpabuf.o
939ifdef CONFIG_WPA_TRACE
940NOBJS += ../src/utils/trace.o
941LIBS_n += -lbfd
942endif
943ifdef TLS_FUNCS
944LIBS_n += -lcrypto
945endif
946
947HOBJS += 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
948HOBJS += ../src/crypto/aes-encblock.o
949ifdef CONFIG_INTERNAL_AES
950HOBJS += ../src/crypto/aes-internal.o
951HOBJS += ../src/crypto/aes-internal-enc.o
952endif
953
954nt_password_hash: $(NOBJS)
955	$(Q)$(CC) $(LDFLAGS) -o nt_password_hash $(NOBJS) $(LIBS_n)
956	@$(E) "  LD " $@
957
958hlr_auc_gw: $(HOBJS)
959	$(Q)$(CC) $(LDFLAGS) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
960	@$(E) "  LD " $@
961
962lcov-html:
963	lcov -c -d .. > lcov.info
964	genhtml lcov.info --output-directory lcov-html
965
966clean:
967	$(MAKE) -C ../src clean
968	rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
969	rm -f *.d *.gcno *.gcda *.gcov
970	rm -f lcov.info
971	rm -rf lcov-html
972
973-include $(OBJS:%.o=%.d)
974