]> git.ipfire.org Git - thirdparty/hostap.git/blame - hostapd/Makefile
Merged EAP-AKA' into eap_aka.c and added it to defconfig/ChangeLog
[thirdparty/hostap.git] / hostapd / Makefile
CommitLineData
6fc6879b
JM
1ifndef CC
2CC=gcc
3endif
4
5ifndef CFLAGS
6CFLAGS = -MMD -O2 -Wall -g
7endif
8
9# define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to
10# a file (undefine it, if you want to save in binary size)
11CFLAGS += -DHOSTAPD_DUMP_STATE
12
13CFLAGS += -I../src
14CFLAGS += -I../src/crypto
15CFLAGS += -I../src/utils
16CFLAGS += -I../src/common
17
18# Uncomment following line and set the path to your kernel tree include
19# directory if your C library does not include all header files.
20# CFLAGS += -DUSE_KERNEL_HEADERS -I/usr/src/linux/include
21
22-include .config
23
24ifndef CONFIG_OS
25ifdef CONFIG_NATIVE_WINDOWS
26CONFIG_OS=win32
27else
28CONFIG_OS=unix
29endif
30endif
31
32ifeq ($(CONFIG_OS), internal)
33CFLAGS += -DOS_NO_C_LIB_DEFINES
34endif
35
36ifdef CONFIG_NATIVE_WINDOWS
37CFLAGS += -DCONFIG_NATIVE_WINDOWS
38LIBS += -lws2_32
39endif
40
41OBJS = hostapd.o ieee802_1x.o eapol_sm.o \
42 ieee802_11.o config.o ieee802_11_auth.o accounting.o \
43 sta_info.o wpa.o ctrl_iface.o \
44 drivers.o preauth.o pmksa_cache.o beacon.o \
fb6d3575 45 hw_features.o wme.o ap_list.o \
d52e94f9 46 mlme.o vlan_init.o wpa_auth_ie.o
6fc6879b
JM
47
48OBJS += ../src/utils/eloop.o
49OBJS += ../src/utils/common.o
50OBJS += ../src/utils/wpa_debug.o
51OBJS += ../src/utils/wpabuf.o
52OBJS += ../src/utils/os_$(CONFIG_OS).o
53OBJS += ../src/utils/ip_addr.o
54
cb7b04c8 55OBJS += ../src/common/ieee802_11_common.o
6fc6879b
JM
56OBJS += ../src/common/wpa_common.o
57
58OBJS += ../src/radius/radius.o
59OBJS += ../src/radius/radius_client.o
60
61OBJS += ../src/crypto/md5.o
62OBJS += ../src/crypto/rc4.o
63OBJS += ../src/crypto/md4.o
64OBJS += ../src/crypto/sha1.o
65OBJS += ../src/crypto/des.o
66OBJS += ../src/crypto/aes_wrap.o
67OBJS += ../src/crypto/aes.o
68
69HOBJS=../src/hlr_auc_gw/hlr_auc_gw.o ../src/utils/common.o ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).o ../src/hlr_auc_gw/milenage.o ../src/crypto/aes_wrap.o ../src/crypto/aes.o
70
71CFLAGS += -DCONFIG_CTRL_IFACE -DCONFIG_CTRL_IFACE_UNIX
72
73ifdef CONFIG_IAPP
74CFLAGS += -DCONFIG_IAPP
75OBJS += iapp.o
76endif
77
78ifdef CONFIG_RSN_PREAUTH
79CFLAGS += -DCONFIG_RSN_PREAUTH
80CONFIG_L2_PACKET=y
81endif
82
83ifdef CONFIG_PEERKEY
84CFLAGS += -DCONFIG_PEERKEY
85OBJS += peerkey.o
86endif
87
88ifdef CONFIG_IEEE80211W
89CFLAGS += -DCONFIG_IEEE80211W
90NEED_SHA256=y
91endif
92
93ifdef CONFIG_IEEE80211R
94CFLAGS += -DCONFIG_IEEE80211R
95OBJS += wpa_ft.o
96NEED_SHA256=y
97endif
98
de9289c8
JM
99ifdef CONFIG_IEEE80211N
100CFLAGS += -DCONFIG_IEEE80211N
101endif
102
6fc6879b
JM
103ifdef CONFIG_DRIVER_HOSTAP
104CFLAGS += -DCONFIG_DRIVER_HOSTAP
105OBJS += driver_hostap.o
106endif
107
108ifdef CONFIG_DRIVER_WIRED
109CFLAGS += -DCONFIG_DRIVER_WIRED
110OBJS += driver_wired.o
111endif
112
113ifdef CONFIG_DRIVER_MADWIFI
114CFLAGS += -DCONFIG_DRIVER_MADWIFI
115OBJS += driver_madwifi.o
116CONFIG_L2_PACKET=y
117endif
118
119ifdef CONFIG_DRIVER_PRISM54
120CFLAGS += -DCONFIG_DRIVER_PRISM54
121OBJS += driver_prism54.o
122endif
123
124ifdef CONFIG_DRIVER_NL80211
125CFLAGS += -DCONFIG_DRIVER_NL80211
126OBJS += driver_nl80211.o radiotap.o
127LIBS += -lnl
128endif
129
130ifdef CONFIG_DRIVER_BSD
131CFLAGS += -DCONFIG_DRIVER_BSD
132OBJS += driver_bsd.o
133CONFIG_L2_PACKET=y
134CONFIG_DNET_PCAP=y
135CONFIG_L2_FREEBSD=y
136endif
137
138ifdef CONFIG_DRIVER_TEST
139CFLAGS += -DCONFIG_DRIVER_TEST
140OBJS += driver_test.o
141endif
142
d64dabee
JM
143ifdef CONFIG_DRIVER_NONE
144CFLAGS += -DCONFIG_DRIVER_NONE
145OBJS += driver_none.o
146endif
147
6fc6879b
JM
148ifdef CONFIG_L2_PACKET
149ifdef CONFIG_DNET_PCAP
150ifdef CONFIG_L2_FREEBSD
151LIBS += -lpcap
152OBJS += ../src/l2_packet/l2_packet_freebsd.o
153else
154LIBS += -ldnet -lpcap
155OBJS += ../src/l2_packet/l2_packet_pcap.o
156endif
157else
158OBJS += ../src/l2_packet/l2_packet_linux.o
159endif
477df071
JM
160else
161OBJS += ../src/l2_packet/l2_packet_none.o
6fc6879b
JM
162endif
163
164
165ifdef CONFIG_EAP_MD5
166CFLAGS += -DEAP_MD5
167OBJS += ../src/eap_server/eap_md5.o
168CHAP=y
169endif
170
171ifdef CONFIG_EAP_TLS
172CFLAGS += -DEAP_TLS
173OBJS += ../src/eap_server/eap_tls.o
174TLS_FUNCS=y
175endif
176
177ifdef CONFIG_EAP_PEAP
178CFLAGS += -DEAP_PEAP
179OBJS += ../src/eap_server/eap_peap.o
2eeaa5c9 180OBJS += ../src/eap_common/eap_peap_common.o
6fc6879b 181TLS_FUNCS=y
6fc6879b
JM
182CONFIG_EAP_MSCHAPV2=y
183endif
184
185ifdef CONFIG_EAP_TTLS
186CFLAGS += -DEAP_TTLS
187OBJS += ../src/eap_server/eap_ttls.o
188TLS_FUNCS=y
189CHAP=y
190endif
191
192ifdef CONFIG_EAP_MSCHAPV2
193CFLAGS += -DEAP_MSCHAPv2
194OBJS += ../src/eap_server/eap_mschapv2.o
195MS_FUNCS=y
196endif
197
198ifdef CONFIG_EAP_GTC
199CFLAGS += -DEAP_GTC
200OBJS += ../src/eap_server/eap_gtc.o
201endif
202
203ifdef CONFIG_EAP_SIM
204CFLAGS += -DEAP_SIM
205OBJS += ../src/eap_server/eap_sim.o
206CONFIG_EAP_SIM_COMMON=y
207endif
208
209ifdef CONFIG_EAP_AKA
210CFLAGS += -DEAP_AKA
211OBJS += ../src/eap_server/eap_aka.o
212CONFIG_EAP_SIM_COMMON=y
213endif
214
8c37556c
JM
215ifdef CONFIG_EAP_AKA_PRIME
216CFLAGS += -DEAP_AKA_PRIME
8c37556c
JM
217endif
218
6fc6879b
JM
219ifdef CONFIG_EAP_SIM_COMMON
220OBJS += ../src/eap_common/eap_sim_common.o
221# Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
222# replaced with another file implementating the interface specified in
223# eap_sim_db.h.
224OBJS += ../src/eap_server/eap_sim_db.o
225NEED_FIPS186_2_PRF=y
226endif
227
228ifdef CONFIG_EAP_PAX
229CFLAGS += -DEAP_PAX
230OBJS += ../src/eap_server/eap_pax.o ../src/eap_common/eap_pax_common.o
231endif
232
233ifdef CONFIG_EAP_PSK
234CFLAGS += -DEAP_PSK
235OBJS += ../src/eap_server/eap_psk.o ../src/eap_common/eap_psk_common.o
236endif
237
238ifdef CONFIG_EAP_SAKE
239CFLAGS += -DEAP_SAKE
240OBJS += ../src/eap_server/eap_sake.o ../src/eap_common/eap_sake_common.o
241endif
242
243ifdef CONFIG_EAP_GPSK
244CFLAGS += -DEAP_GPSK
245OBJS += ../src/eap_server/eap_gpsk.o ../src/eap_common/eap_gpsk_common.o
246ifdef CONFIG_EAP_GPSK_SHA256
247CFLAGS += -DEAP_GPSK_SHA256
248endif
249NEED_SHA256=y
250endif
251
252ifdef CONFIG_EAP_VENDOR_TEST
253CFLAGS += -DEAP_VENDOR_TEST
254OBJS += ../src/eap_server/eap_vendor_test.o
255endif
256
6fc6879b
JM
257ifdef CONFIG_EAP_FAST
258CFLAGS += -DEAP_FAST
259OBJS += ../src/eap_server/eap_fast.o
a4819630 260OBJS += ../src/eap_common/eap_fast_common.o
6fc6879b
JM
261TLS_FUNCS=y
262NEED_T_PRF=y
263endif
264
ad08c363
JM
265ifdef CONFIG_WPS
266CFLAGS += -DCONFIG_WPS -DEAP_WSC
267OBJS += ../src/utils/uuid.o
268OBJS += wps_hostapd.o
269OBJS += ../src/eap_server/eap_wsc.o ../src/eap_common/eap_wsc_common.o
270OBJS += ../src/wps/wps.o
271OBJS += ../src/wps/wps_common.o
7d7b8e96
JM
272OBJS += ../src/wps/wps_attr_parse.o
273OBJS += ../src/wps/wps_attr_build.o
274OBJS += ../src/wps/wps_attr_process.o
ad08c363
JM
275OBJS += ../src/wps/wps_dev_attr.o
276OBJS += ../src/wps/wps_enrollee.o
277OBJS += ../src/wps/wps_registrar.o
278NEED_DH_GROUPS=y
279NEED_SHA256=y
280NEED_CRYPTO=y
281endif
282
6fc6879b
JM
283ifdef CONFIG_EAP_IKEV2
284CFLAGS += -DEAP_IKEV2
285OBJS += ../src/eap_server/eap_ikev2.o ../src/eap_server/ikev2.o
286OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
287NEED_DH_GROUPS=y
288endif
289
da08a7c7
JM
290ifdef CONFIG_EAP_TNC
291CFLAGS += -DEAP_TNC
292OBJS += ../src/eap_server/eap_tnc.o
293OBJS += ../src/eap_server/tncs.o
294NEED_BASE64=y
295endif
296
6fc6879b
JM
297# Basic EAP functionality is needed for EAPOL
298OBJS += ../src/eap_server/eap.o
299OBJS += ../src/eap_common/eap_common.o
300OBJS += ../src/eap_server/eap_methods.o
301OBJS += ../src/eap_server/eap_identity.o
302
303ifdef CONFIG_EAP
304CFLAGS += -DEAP_SERVER
305endif
306
307ifndef CONFIG_TLS
308CONFIG_TLS=openssl
309endif
310
311ifeq ($(CONFIG_TLS), internal)
312ifndef CONFIG_CRYPTO
313CONFIG_CRYPTO=internal
314endif
315endif
316ifeq ($(CONFIG_CRYPTO), libtomcrypt)
317CFLAGS += -DCONFIG_INTERNAL_X509
318endif
319ifeq ($(CONFIG_CRYPTO), internal)
320CFLAGS += -DCONFIG_INTERNAL_X509
321endif
322
323
324ifdef TLS_FUNCS
325# Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
326CFLAGS += -DEAP_TLS_FUNCS
327OBJS += ../src/eap_server/eap_tls_common.o
328ifeq ($(CONFIG_TLS), openssl)
329OBJS += ../src/crypto/tls_openssl.o
330LIBS += -lssl -lcrypto
331LIBS_p += -lcrypto
332LIBS_h += -lcrypto
333endif
334ifeq ($(CONFIG_TLS), gnutls)
335OBJS += ../src/crypto/tls_gnutls.o
336LIBS += -lgnutls -lgcrypt -lgpg-error
337LIBS_p += -lgcrypt
338LIBS_h += -lgcrypt
339endif
340ifdef CONFIG_GNUTLS_EXTRA
341CFLAGS += -DCONFIG_GNUTLS_EXTRA
342LIBS += -lgnutls-extra
343endif
344ifeq ($(CONFIG_TLS), internal)
345OBJS += ../src/crypto/tls_internal.o
346OBJS += ../src/tls/tlsv1_common.o ../src/tls/tlsv1_record.o
347OBJS += ../src/tls/tlsv1_cred.o ../src/tls/tlsv1_server.o
348OBJS += ../src/tls/tlsv1_server_write.o ../src/tls/tlsv1_server_read.o
349OBJS += ../src/tls/asn1.o ../src/tls/x509v3.o
350OBJS_p += ../src/tls/asn1.o
351OBJS_p += ../src/crypto/rc4.o ../src/crypto/aes_wrap.o ../src/crypto/aes.o
352NEED_BASE64=y
353CFLAGS += -DCONFIG_TLS_INTERNAL
354CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
355ifeq ($(CONFIG_CRYPTO), internal)
356ifdef CONFIG_INTERNAL_LIBTOMMATH
357CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
358else
359LIBS += -ltommath
360LIBS_p += -ltommath
361endif
362endif
363ifeq ($(CONFIG_CRYPTO), libtomcrypt)
364LIBS += -ltomcrypt -ltfm
365LIBS_p += -ltomcrypt -ltfm
366endif
367endif
368NEED_CRYPTO=y
369else
370OBJS += ../src/crypto/tls_none.o
371endif
372
373ifdef CONFIG_PKCS12
374CFLAGS += -DPKCS12_FUNCS
375endif
376
377ifdef MS_FUNCS
378OBJS += ../src/crypto/ms_funcs.o
379NEED_CRYPTO=y
380endif
381
382ifdef CHAP
383OBJS += ../src/eap_common/chap.o
384endif
385
386ifdef NEED_CRYPTO
387ifndef TLS_FUNCS
388ifeq ($(CONFIG_TLS), openssl)
389LIBS += -lcrypto
390LIBS_p += -lcrypto
391LIBS_h += -lcrypto
392endif
393ifeq ($(CONFIG_TLS), gnutls)
394LIBS += -lgcrypt
395LIBS_p += -lgcrypt
396LIBS_h += -lgcrypt
397endif
398ifeq ($(CONFIG_TLS), internal)
399ifeq ($(CONFIG_CRYPTO), libtomcrypt)
400LIBS += -ltomcrypt -ltfm
401LIBS_p += -ltomcrypt -ltfm
402endif
403endif
404endif
405ifeq ($(CONFIG_TLS), openssl)
406OBJS += ../src/crypto/crypto_openssl.o
407OBJS_p += ../src/crypto/crypto_openssl.o
408HOBJS += ../src/crypto/crypto_openssl.o
409CONFIG_INTERNAL_SHA256=y
410endif
411ifeq ($(CONFIG_TLS), gnutls)
412OBJS += ../src/crypto/crypto_gnutls.o
413OBJS_p += ../src/crypto/crypto_gnutls.o
414HOBJS += ../src/crypto/crypto_gnutls.o
415CONFIG_INTERNAL_SHA256=y
416endif
417ifeq ($(CONFIG_TLS), internal)
418ifeq ($(CONFIG_CRYPTO), libtomcrypt)
419OBJS += ../src/crypto/crypto_libtomcrypt.o
420OBJS_p += ../src/crypto/crypto_libtomcrypt.o
421CONFIG_INTERNAL_SHA256=y
422endif
423ifeq ($(CONFIG_CRYPTO), internal)
424OBJS += ../src/crypto/crypto_internal.o ../src/tls/rsa.o ../src/tls/bignum.o
425OBJS_p += ../src/crypto/crypto_internal.o ../src/tls/rsa.o ../src/tls/bignum.o
426CFLAGS += -DCONFIG_CRYPTO_INTERNAL
427CONFIG_INTERNAL_AES=y
428CONFIG_INTERNAL_DES=y
429CONFIG_INTERNAL_SHA1=y
430CONFIG_INTERNAL_MD4=y
431CONFIG_INTERNAL_MD5=y
432CONFIG_INTERNAL_SHA256=y
433endif
434endif
435else
436CONFIG_INTERNAL_AES=y
437CONFIG_INTERNAL_SHA1=y
438CONFIG_INTERNAL_MD5=y
439CONFIG_INTERNAL_SHA256=y
440endif
441
442ifdef CONFIG_INTERNAL_AES
443CFLAGS += -DINTERNAL_AES
444endif
445ifdef CONFIG_INTERNAL_SHA1
446CFLAGS += -DINTERNAL_SHA1
447endif
448ifdef CONFIG_INTERNAL_SHA256
449CFLAGS += -DINTERNAL_SHA256
450endif
451ifdef CONFIG_INTERNAL_MD5
452CFLAGS += -DINTERNAL_MD5
453endif
454ifdef CONFIG_INTERNAL_MD4
455CFLAGS += -DINTERNAL_MD4
456endif
457ifdef CONFIG_INTERNAL_DES
458CFLAGS += -DINTERNAL_DES
459endif
460
461ifdef NEED_SHA256
462OBJS += ../src/crypto/sha256.o
463endif
464
465ifdef NEED_DH_GROUPS
466OBJS += ../src/crypto/dh_groups.o
467endif
468
469ifndef NEED_FIPS186_2_PRF
470CFLAGS += -DCONFIG_NO_FIPS186_2_PRF
471endif
472
473ifndef NEED_T_PRF
474CFLAGS += -DCONFIG_NO_T_PRF
475endif
476
477ifdef CONFIG_RADIUS_SERVER
478CFLAGS += -DRADIUS_SERVER
479OBJS += ../src/radius/radius_server.o
480endif
481
482ifdef CONFIG_IPV6
483CFLAGS += -DCONFIG_IPV6
484endif
485
6affdaee
CZ
486ifdef CONFIG_DRIVER_RADIUS_ACL
487CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
488endif
489
6fc6879b
JM
490ifdef CONFIG_FULL_DYNAMIC_VLAN
491# define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
492# and vlan interfaces for the vlan feature.
493CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
494endif
495
496ifdef NEED_BASE64
497OBJS += ../src/utils/base64.o
498endif
499
500ALL=hostapd hostapd_cli
501
502all: verify_config $(ALL)
503
504verify_config:
505 @if [ ! -r .config ]; then \
506 echo 'Building hostapd requires a configuration file'; \
507 echo '(.config). See README for more instructions. You can'; \
508 echo 'run "cp defconfig .config" to create an example'; \
509 echo 'configuration.'; \
510 exit 1; \
511 fi
512
513install: all
514 for i in $(ALL); do cp $$i /usr/local/bin/$$i; done
515
516hostapd: $(OBJS)
517 $(CC) -o hostapd $(OBJS) $(LIBS)
518
519OBJS_c = hostapd_cli.o ../src/common/wpa_ctrl.o ../src/utils/os_$(CONFIG_OS).o
520hostapd_cli: $(OBJS_c)
521 $(CC) -o hostapd_cli $(OBJS_c)
522
523NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o ../src/crypto/sha1.o ../src/crypto/rc4.o ../src/crypto/md5.o
524NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o
525ifdef TLS_FUNCS
526LIBS_n += -lcrypto
527endif
528
529nt_password_hash: $(NOBJS)
530 $(CC) -o nt_password_hash $(NOBJS) $(LIBS_n)
531
532hlr_auc_gw: $(HOBJS)
533 $(CC) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
534
535clean:
536 $(MAKE) -C ../src clean
537 rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
538 rm -f *.d
539
540%.eps: %.fig
541 fig2dev -L eps $*.fig $*.eps
542
543%.png: %.fig
544 fig2dev -L png -m 3 $*.fig | pngtopnm | pnmscale 0.4 | pnmtopng \
545 > $*.png
546
547docs-pics: doc/hostapd.png doc/hostapd.eps
548
549docs: docs-pics
550 doxygen doc/doxygen.full
551 $(MAKE) -C doc/latex
552 cp doc/latex/refman.pdf hostapd-devel.pdf
553
554docs-fast: docs-pics
555 doxygen doc/doxygen.fast
556
557clean-docs:
558 rm -rf doc/latex doc/html
559 rm -f doc/hosta.d{eps,png} hostapd-devel.pdf
560
561TEST_SRC_MILENAGE = ../src/hlr_auc_gw/milenage.c ../src/crypto/aes_wrap.c ../src/crypto/aes.c ../src/utils/common.c ../src/utils/wpa_debug.o ../src/utils/os_$(CONFIG_OS).c
562test-milenage: $(TEST_SRC_MILENAGE)
563 $(CC) -o test-milenage -Wall -Werror $(TEST_SRC_MILENAGE) \
564 -DTEST_MAIN_MILENAGE -I. -DINTERNAL_AES \
565 -I../src/crypto -I../src/utils
566 ./test-milenage
567 rm test-milenage
568
569hostapd-sparse: $(OBJS)
570 @echo Sparse run completed
571
572run-sparse:
573 CC="sparse -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -D__INT_MAX__=2147483647 -D__SHRT_MAX__=32767 -D__LONG_MAX__=2147483647 -D__SCHAR_MAX__=127 -Wbitwise" $(MAKE) hostapd-sparse
574
575-include $(OBJS:%.o=%.d)