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