]> git.ipfire.org Git - thirdparty/hostap.git/blame - hostapd/Makefile
Added a TODO item for sending protected Disassoc after failed SA Query
[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
205a372b
JM
128ifdef CONFIG_LIBNL20
129LIBS += -lnl-genl
130CFLAGS += -DCONFIG_LIBNL20
131endif
6fc6879b
JM
132endif
133
134ifdef CONFIG_DRIVER_BSD
135CFLAGS += -DCONFIG_DRIVER_BSD
136OBJS += driver_bsd.o
137CONFIG_L2_PACKET=y
138CONFIG_DNET_PCAP=y
139CONFIG_L2_FREEBSD=y
140endif
141
142ifdef CONFIG_DRIVER_TEST
143CFLAGS += -DCONFIG_DRIVER_TEST
144OBJS += driver_test.o
145endif
146
d64dabee
JM
147ifdef CONFIG_DRIVER_NONE
148CFLAGS += -DCONFIG_DRIVER_NONE
149OBJS += driver_none.o
150endif
151
6fc6879b
JM
152ifdef CONFIG_L2_PACKET
153ifdef CONFIG_DNET_PCAP
154ifdef CONFIG_L2_FREEBSD
155LIBS += -lpcap
156OBJS += ../src/l2_packet/l2_packet_freebsd.o
157else
158LIBS += -ldnet -lpcap
159OBJS += ../src/l2_packet/l2_packet_pcap.o
160endif
161else
162OBJS += ../src/l2_packet/l2_packet_linux.o
163endif
477df071
JM
164else
165OBJS += ../src/l2_packet/l2_packet_none.o
6fc6879b
JM
166endif
167
168
169ifdef CONFIG_EAP_MD5
170CFLAGS += -DEAP_MD5
171OBJS += ../src/eap_server/eap_md5.o
172CHAP=y
173endif
174
175ifdef CONFIG_EAP_TLS
176CFLAGS += -DEAP_TLS
177OBJS += ../src/eap_server/eap_tls.o
178TLS_FUNCS=y
179endif
180
181ifdef CONFIG_EAP_PEAP
182CFLAGS += -DEAP_PEAP
183OBJS += ../src/eap_server/eap_peap.o
2eeaa5c9 184OBJS += ../src/eap_common/eap_peap_common.o
6fc6879b 185TLS_FUNCS=y
6fc6879b
JM
186CONFIG_EAP_MSCHAPV2=y
187endif
188
189ifdef CONFIG_EAP_TTLS
190CFLAGS += -DEAP_TTLS
191OBJS += ../src/eap_server/eap_ttls.o
192TLS_FUNCS=y
193CHAP=y
194endif
195
196ifdef CONFIG_EAP_MSCHAPV2
197CFLAGS += -DEAP_MSCHAPv2
198OBJS += ../src/eap_server/eap_mschapv2.o
199MS_FUNCS=y
200endif
201
202ifdef CONFIG_EAP_GTC
203CFLAGS += -DEAP_GTC
204OBJS += ../src/eap_server/eap_gtc.o
205endif
206
207ifdef CONFIG_EAP_SIM
208CFLAGS += -DEAP_SIM
209OBJS += ../src/eap_server/eap_sim.o
210CONFIG_EAP_SIM_COMMON=y
211endif
212
213ifdef CONFIG_EAP_AKA
214CFLAGS += -DEAP_AKA
215OBJS += ../src/eap_server/eap_aka.o
216CONFIG_EAP_SIM_COMMON=y
217endif
218
8c37556c
JM
219ifdef CONFIG_EAP_AKA_PRIME
220CFLAGS += -DEAP_AKA_PRIME
8c37556c
JM
221endif
222
6fc6879b
JM
223ifdef CONFIG_EAP_SIM_COMMON
224OBJS += ../src/eap_common/eap_sim_common.o
225# Example EAP-SIM/AKA interface for GSM/UMTS authentication. This can be
226# replaced with another file implementating the interface specified in
227# eap_sim_db.h.
228OBJS += ../src/eap_server/eap_sim_db.o
229NEED_FIPS186_2_PRF=y
230endif
231
232ifdef CONFIG_EAP_PAX
233CFLAGS += -DEAP_PAX
234OBJS += ../src/eap_server/eap_pax.o ../src/eap_common/eap_pax_common.o
235endif
236
237ifdef CONFIG_EAP_PSK
238CFLAGS += -DEAP_PSK
239OBJS += ../src/eap_server/eap_psk.o ../src/eap_common/eap_psk_common.o
240endif
241
242ifdef CONFIG_EAP_SAKE
243CFLAGS += -DEAP_SAKE
244OBJS += ../src/eap_server/eap_sake.o ../src/eap_common/eap_sake_common.o
245endif
246
247ifdef CONFIG_EAP_GPSK
248CFLAGS += -DEAP_GPSK
249OBJS += ../src/eap_server/eap_gpsk.o ../src/eap_common/eap_gpsk_common.o
250ifdef CONFIG_EAP_GPSK_SHA256
251CFLAGS += -DEAP_GPSK_SHA256
252endif
253NEED_SHA256=y
254endif
255
256ifdef CONFIG_EAP_VENDOR_TEST
257CFLAGS += -DEAP_VENDOR_TEST
258OBJS += ../src/eap_server/eap_vendor_test.o
259endif
260
6fc6879b
JM
261ifdef CONFIG_EAP_FAST
262CFLAGS += -DEAP_FAST
263OBJS += ../src/eap_server/eap_fast.o
a4819630 264OBJS += ../src/eap_common/eap_fast_common.o
6fc6879b
JM
265TLS_FUNCS=y
266NEED_T_PRF=y
267endif
268
ad08c363
JM
269ifdef CONFIG_WPS
270CFLAGS += -DCONFIG_WPS -DEAP_WSC
271OBJS += ../src/utils/uuid.o
272OBJS += wps_hostapd.o
273OBJS += ../src/eap_server/eap_wsc.o ../src/eap_common/eap_wsc_common.o
274OBJS += ../src/wps/wps.o
275OBJS += ../src/wps/wps_common.o
7d7b8e96
JM
276OBJS += ../src/wps/wps_attr_parse.o
277OBJS += ../src/wps/wps_attr_build.o
278OBJS += ../src/wps/wps_attr_process.o
ad08c363
JM
279OBJS += ../src/wps/wps_dev_attr.o
280OBJS += ../src/wps/wps_enrollee.o
281OBJS += ../src/wps/wps_registrar.o
282NEED_DH_GROUPS=y
283NEED_SHA256=y
284NEED_CRYPTO=y
285endif
286
6fc6879b
JM
287ifdef CONFIG_EAP_IKEV2
288CFLAGS += -DEAP_IKEV2
289OBJS += ../src/eap_server/eap_ikev2.o ../src/eap_server/ikev2.o
290OBJS += ../src/eap_common/eap_ikev2_common.o ../src/eap_common/ikev2_common.o
291NEED_DH_GROUPS=y
292endif
293
da08a7c7
JM
294ifdef CONFIG_EAP_TNC
295CFLAGS += -DEAP_TNC
296OBJS += ../src/eap_server/eap_tnc.o
297OBJS += ../src/eap_server/tncs.o
298NEED_BASE64=y
299endif
300
6fc6879b
JM
301# Basic EAP functionality is needed for EAPOL
302OBJS += ../src/eap_server/eap.o
303OBJS += ../src/eap_common/eap_common.o
304OBJS += ../src/eap_server/eap_methods.o
305OBJS += ../src/eap_server/eap_identity.o
306
307ifdef CONFIG_EAP
308CFLAGS += -DEAP_SERVER
309endif
310
311ifndef CONFIG_TLS
312CONFIG_TLS=openssl
313endif
314
315ifeq ($(CONFIG_TLS), internal)
316ifndef CONFIG_CRYPTO
317CONFIG_CRYPTO=internal
318endif
319endif
320ifeq ($(CONFIG_CRYPTO), libtomcrypt)
321CFLAGS += -DCONFIG_INTERNAL_X509
322endif
323ifeq ($(CONFIG_CRYPTO), internal)
324CFLAGS += -DCONFIG_INTERNAL_X509
325endif
326
327
328ifdef TLS_FUNCS
329# Shared TLS functions (needed for EAP_TLS, EAP_PEAP, and EAP_TTLS)
330CFLAGS += -DEAP_TLS_FUNCS
331OBJS += ../src/eap_server/eap_tls_common.o
332ifeq ($(CONFIG_TLS), openssl)
333OBJS += ../src/crypto/tls_openssl.o
334LIBS += -lssl -lcrypto
335LIBS_p += -lcrypto
336LIBS_h += -lcrypto
337endif
338ifeq ($(CONFIG_TLS), gnutls)
339OBJS += ../src/crypto/tls_gnutls.o
340LIBS += -lgnutls -lgcrypt -lgpg-error
341LIBS_p += -lgcrypt
342LIBS_h += -lgcrypt
343endif
344ifdef CONFIG_GNUTLS_EXTRA
345CFLAGS += -DCONFIG_GNUTLS_EXTRA
346LIBS += -lgnutls-extra
347endif
348ifeq ($(CONFIG_TLS), internal)
349OBJS += ../src/crypto/tls_internal.o
350OBJS += ../src/tls/tlsv1_common.o ../src/tls/tlsv1_record.o
351OBJS += ../src/tls/tlsv1_cred.o ../src/tls/tlsv1_server.o
352OBJS += ../src/tls/tlsv1_server_write.o ../src/tls/tlsv1_server_read.o
353OBJS += ../src/tls/asn1.o ../src/tls/x509v3.o
354OBJS_p += ../src/tls/asn1.o
355OBJS_p += ../src/crypto/rc4.o ../src/crypto/aes_wrap.o ../src/crypto/aes.o
356NEED_BASE64=y
357CFLAGS += -DCONFIG_TLS_INTERNAL
358CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
359ifeq ($(CONFIG_CRYPTO), internal)
360ifdef CONFIG_INTERNAL_LIBTOMMATH
361CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
362else
363LIBS += -ltommath
364LIBS_p += -ltommath
365endif
366endif
367ifeq ($(CONFIG_CRYPTO), libtomcrypt)
368LIBS += -ltomcrypt -ltfm
369LIBS_p += -ltomcrypt -ltfm
370endif
371endif
372NEED_CRYPTO=y
373else
374OBJS += ../src/crypto/tls_none.o
375endif
376
377ifdef CONFIG_PKCS12
378CFLAGS += -DPKCS12_FUNCS
379endif
380
381ifdef MS_FUNCS
382OBJS += ../src/crypto/ms_funcs.o
383NEED_CRYPTO=y
384endif
385
386ifdef CHAP
387OBJS += ../src/eap_common/chap.o
388endif
389
390ifdef NEED_CRYPTO
391ifndef TLS_FUNCS
392ifeq ($(CONFIG_TLS), openssl)
393LIBS += -lcrypto
394LIBS_p += -lcrypto
395LIBS_h += -lcrypto
396endif
397ifeq ($(CONFIG_TLS), gnutls)
398LIBS += -lgcrypt
399LIBS_p += -lgcrypt
400LIBS_h += -lgcrypt
401endif
402ifeq ($(CONFIG_TLS), internal)
403ifeq ($(CONFIG_CRYPTO), libtomcrypt)
404LIBS += -ltomcrypt -ltfm
405LIBS_p += -ltomcrypt -ltfm
406endif
407endif
408endif
409ifeq ($(CONFIG_TLS), openssl)
410OBJS += ../src/crypto/crypto_openssl.o
411OBJS_p += ../src/crypto/crypto_openssl.o
412HOBJS += ../src/crypto/crypto_openssl.o
413CONFIG_INTERNAL_SHA256=y
414endif
415ifeq ($(CONFIG_TLS), gnutls)
416OBJS += ../src/crypto/crypto_gnutls.o
417OBJS_p += ../src/crypto/crypto_gnutls.o
418HOBJS += ../src/crypto/crypto_gnutls.o
419CONFIG_INTERNAL_SHA256=y
420endif
421ifeq ($(CONFIG_TLS), internal)
422ifeq ($(CONFIG_CRYPTO), libtomcrypt)
423OBJS += ../src/crypto/crypto_libtomcrypt.o
424OBJS_p += ../src/crypto/crypto_libtomcrypt.o
425CONFIG_INTERNAL_SHA256=y
426endif
427ifeq ($(CONFIG_CRYPTO), internal)
428OBJS += ../src/crypto/crypto_internal.o ../src/tls/rsa.o ../src/tls/bignum.o
429OBJS_p += ../src/crypto/crypto_internal.o ../src/tls/rsa.o ../src/tls/bignum.o
430CFLAGS += -DCONFIG_CRYPTO_INTERNAL
431CONFIG_INTERNAL_AES=y
432CONFIG_INTERNAL_DES=y
433CONFIG_INTERNAL_SHA1=y
434CONFIG_INTERNAL_MD4=y
435CONFIG_INTERNAL_MD5=y
436CONFIG_INTERNAL_SHA256=y
437endif
438endif
439else
440CONFIG_INTERNAL_AES=y
441CONFIG_INTERNAL_SHA1=y
442CONFIG_INTERNAL_MD5=y
443CONFIG_INTERNAL_SHA256=y
444endif
445
446ifdef CONFIG_INTERNAL_AES
447CFLAGS += -DINTERNAL_AES
448endif
449ifdef CONFIG_INTERNAL_SHA1
450CFLAGS += -DINTERNAL_SHA1
451endif
452ifdef CONFIG_INTERNAL_SHA256
453CFLAGS += -DINTERNAL_SHA256
454endif
455ifdef CONFIG_INTERNAL_MD5
456CFLAGS += -DINTERNAL_MD5
457endif
458ifdef CONFIG_INTERNAL_MD4
459CFLAGS += -DINTERNAL_MD4
460endif
461ifdef CONFIG_INTERNAL_DES
462CFLAGS += -DINTERNAL_DES
463endif
464
465ifdef NEED_SHA256
466OBJS += ../src/crypto/sha256.o
467endif
468
469ifdef NEED_DH_GROUPS
470OBJS += ../src/crypto/dh_groups.o
471endif
472
473ifndef NEED_FIPS186_2_PRF
474CFLAGS += -DCONFIG_NO_FIPS186_2_PRF
475endif
476
477ifndef NEED_T_PRF
478CFLAGS += -DCONFIG_NO_T_PRF
479endif
480
481ifdef CONFIG_RADIUS_SERVER
482CFLAGS += -DRADIUS_SERVER
483OBJS += ../src/radius/radius_server.o
484endif
485
486ifdef CONFIG_IPV6
487CFLAGS += -DCONFIG_IPV6
488endif
489
6affdaee
CZ
490ifdef CONFIG_DRIVER_RADIUS_ACL
491CFLAGS += -DCONFIG_DRIVER_RADIUS_ACL
492endif
493
6fc6879b
JM
494ifdef CONFIG_FULL_DYNAMIC_VLAN
495# define CONFIG_FULL_DYNAMIC_VLAN to have hostapd manipulate bridges
496# and vlan interfaces for the vlan feature.
497CFLAGS += -DCONFIG_FULL_DYNAMIC_VLAN
498endif
499
500ifdef NEED_BASE64
501OBJS += ../src/utils/base64.o
502endif
503
504ALL=hostapd hostapd_cli
505
506all: verify_config $(ALL)
507
508verify_config:
509 @if [ ! -r .config ]; then \
510 echo 'Building hostapd requires a configuration file'; \
511 echo '(.config). See README for more instructions. You can'; \
512 echo 'run "cp defconfig .config" to create an example'; \
513 echo 'configuration.'; \
514 exit 1; \
515 fi
516
517install: all
518 for i in $(ALL); do cp $$i /usr/local/bin/$$i; done
519
520hostapd: $(OBJS)
521 $(CC) -o hostapd $(OBJS) $(LIBS)
522
523OBJS_c = hostapd_cli.o ../src/common/wpa_ctrl.o ../src/utils/os_$(CONFIG_OS).o
524hostapd_cli: $(OBJS_c)
525 $(CC) -o hostapd_cli $(OBJS_c)
526
527NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o ../src/crypto/sha1.o ../src/crypto/rc4.o ../src/crypto/md5.o
528NOBJS += ../src/crypto/crypto_openssl.o ../src/utils/os_$(CONFIG_OS).o
529ifdef TLS_FUNCS
530LIBS_n += -lcrypto
531endif
532
533nt_password_hash: $(NOBJS)
534 $(CC) -o nt_password_hash $(NOBJS) $(LIBS_n)
535
536hlr_auc_gw: $(HOBJS)
537 $(CC) -o hlr_auc_gw $(HOBJS) $(LIBS_h)
538
539clean:
540 $(MAKE) -C ../src clean
541 rm -f core *~ *.o hostapd hostapd_cli nt_password_hash hlr_auc_gw
542 rm -f *.d
543
544%.eps: %.fig
545 fig2dev -L eps $*.fig $*.eps
546
547%.png: %.fig
548 fig2dev -L png -m 3 $*.fig | pngtopnm | pnmscale 0.4 | pnmtopng \
549 > $*.png
550
551docs-pics: doc/hostapd.png doc/hostapd.eps
552
553docs: docs-pics
554 doxygen doc/doxygen.full
555 $(MAKE) -C doc/latex
556 cp doc/latex/refman.pdf hostapd-devel.pdf
557
558docs-fast: docs-pics
559 doxygen doc/doxygen.fast
560
561clean-docs:
562 rm -rf doc/latex doc/html
563 rm -f doc/hosta.d{eps,png} hostapd-devel.pdf
564
565TEST_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
566test-milenage: $(TEST_SRC_MILENAGE)
567 $(CC) -o test-milenage -Wall -Werror $(TEST_SRC_MILENAGE) \
568 -DTEST_MAIN_MILENAGE -I. -DINTERNAL_AES \
569 -I../src/crypto -I../src/utils
570 ./test-milenage
571 rm test-milenage
572
573hostapd-sparse: $(OBJS)
574 @echo Sparse run completed
575
576run-sparse:
577 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
578
579-include $(OBJS:%.o=%.d)