xref: /freebsd/usr.sbin/wpa/wpa_supplicant/Makefile (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
1# $FreeBSD$
2
3.include <bsd.own.mk>
4
5WPA_SUPPLICANT_DISTDIR?= ${.CURDIR}/../../../contrib/wpa_supplicant
6.PATH: ${.CURDIR}/.. ${WPA_SUPPLICANT_DISTDIR}
7
8PROG=	wpa_supplicant
9SRCS=	config.c eloop.c common.c md5.c rc4.c sha1.c aes_wrap.c \
10	wpa_supplicant.c events.c wpa.c preauth.c pmksa_cache.c \
11	ctrl_iface.c ctrl_iface_unix.c l2_packet.c main.c drivers.c \
12	driver_ndis.c Packet32.c \
13	driver_wired.c \
14	driver_freebsd.c os_unix.c
15
16MAN=	wpa_supplicant.8 wpa_supplicant.conf.5
17
18.if ${MK_EXAMPLES} != "no"
19FILESDIR= ${SHAREDIR}/examples/wpa_supplicant
20FILES=	wpa_supplicant.conf
21.endif
22
23CFLAGS+= -I${.CURDIR} -I${WPA_SUPPLICANT_DISTDIR}
24CFLAGS+= -DCONFIG_DRIVER_BSD
25CFLAGS+= -DCONFIG_DRIVER_NDIS
26CFLAGS+= -DCONFIG_DRIVER_WIRED
27CFLAGS+= -DCONFIG_CTRL_IFACE
28CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX
29CFLAGS+= -DCONFIG_TERMINATE_ONLASTIF
30CFLAGS+= -g
31DPADD+=	${LIBPCAP}
32LDADD+=	-lpcap
33
34# NB: we only support wpa_supplicant.conf file
35SRCS+=	config_file.c base64.c
36CFLAGS+=-DCONFIG_BACKEND_FILE
37
38# User customizations to the wpa_supplicant build environment
39CFLAGS+=${WPA_SUPPLICANT_CFLAGS}
40#DPADD+=${WPA_SUPPLICANT_DPADD}
41LDADD+=${WPA_SUPPLICANT_LDADD}
42#LDFLAGS+=${WPA_SUPPLICANT_LDFLAGS}
43
44.if ${MK_WPA_SUPPLICANT_EAPOL} != "no"
45SRCS+=	eapol_sm.c eap.c eap_methods.c
46CFLAGS+= -DIEEE8021X_EAPOL
47
48.if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH)
49CFLAGS+=-DEAP_TLS -DEAP_PEAP -DEAP_MSCHAPv2 -DEAP_LEAP -DEAP_PSK \
50	-DEAP_TLV -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL
51SRCS+=	eap_tls.c eap_peap.c eap_mschapv2.c eap_leap.c \
52	eap_psk.c eap_psk_common.c \
53	eap_tlv.c eap_tls_common.c tls_openssl.c ms_funcs.c crypto.c
54
55CFLAGS+=-DEAP_TTLS -DEAP_MD5
56SRCS+=	eap_ttls.c eap_md5.c
57
58.if !empty(CFLAGS:M*-DEAP_GTC)
59SRCS+=	eap_gtc.c
60.endif
61
62.if !empty(CFLAGS:M*-DEAP_OTP)
63SRCS+=	eap_otp.c
64.endif
65
66.if !empty(CFLAGS:M*-DEAP_AKA)
67NEED_SIM_COMMON=	true
68SRCS+=	eap_aka.c
69.endif
70
71.if !empty(CFLAGS:M*-DEAP_SIM)
72NEED_SIM_COMMON=	true
73SRCS+=	eap_sim.c
74.endif
75
76.if defined(NEED_SIM_COMMON)
77SRCS+=	eap_sim_common.c
78
79# PC/SC interface for smartcards (USIM, GSM SIM)
80# GSM/UMTS authentication algorithm (for EAP-SIM/EAP-AKA)
81# NB: requires devel/pcsc-lite
82#
83# WPA_SUPPLICANT_CFLAGS=-DEAP_AKA -DPCSC_FUNCS -I/usr/local/include/PCSC
84# WPA_SUPPLICANT_LDADD=-L/usr/local/lib
85#
86.if !empty(CFLAGS:M*-DPCSC_FUNCS)
87SRCS+=	pcsc_funcs.c
88DPADD+=${LIBPTHREAD}
89LDADD+=-lpcsclite -lpthread
90.endif
91.endif
92
93.if !empty(CFLAGS:M*-DEAP_GPSK)
94CFLAGS+=-DEAP_GPSK_SHA256
95SRCS+=	eap_gpsk.c eap_gpsk_common.c
96NEED_SHA256=	true
97.endif
98
99.if !empty(CFLAGS:M*-DEAP_PAX)
100SRCS+=	eap_pax.c eap_pax_common.c
101.endif
102
103.if !empty(CFLAGS:M*-DEAP_SAKE)
104SRCS+=	eap_sake.c eap_sake_common.c
105.endif
106
107# NB: requires patch to openssl
108#CFLAGS+= -DEAP_FAST
109#SRCS+=	eap_fast.c
110
111NEED_LIBSSL=	true
112.else
113CFLAGS+= -DEAP_TLS_NONE
114SRCS+=	tls_none.c
115.endif
116
117.endif
118
119#
120# Configure crypto/cipher support.
121#
122# EAPOL support requires openssl in which case we use their
123# cipher code.  Otherwise we use our internal versions.
124#
125.if !defined(NEED_LIBSSL)
126CFLAGS+= -DINTERNAL_AES
127CFLAGS+= -DINTERNAL_SHA1
128CFLAGS+= -DINTERNAL_MD5
129.else
130DPADD+= ${LIBSSL} ${LIBCRYPTO}
131LDADD+= -lssl -lcrypto
132.endif
133
134.if defined(NEED_SHA256)
135CFLAGS+=-DINTERNAL_SHA256
136SRCS+=	sha256.c
137.endif
138
139.include <bsd.prog.mk>
140