xref: /freebsd/usr.sbin/wpa/hostapd/Makefile (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
1# $FreeBSD$
2
3.include <bsd.own.mk>
4
5HOSTAPD_DISTDIR?= ${.CURDIR}/../../../contrib/hostapd
6.PATH: ${.CURDIR}/.. ${HOSTAPD_DISTDIR}
7
8PROG=	hostapd
9SRCS=	hostapd.c eloop.c ieee802_1x.c eapol_sm.c radius.c md5.c rc4.c \
10	common.c ieee802_11.c config.c ieee802_11_auth.c accounting.c \
11	sta_info.c radius_client.c sha1.c wpa.c aes_wrap.c ctrl_iface.c \
12	driver_conf.c os_unix.c preauth.c pmksa_cache.c beacon.c \
13	hw_features.c wme.c ap_list.c reconfig.c mlme.c \
14	vlan_init.c ieee802_11h.c l2_packet.c driver_freebsd.c
15CLEANFILES=driver_conf.c
16
17MAN=	hostapd.8 hostapd.conf.5
18
19.if ${MK_EXAMPLES} != "no"
20FILESDIR= ${SHAREDIR}/examples/hostapd
21FILES=	hostapd.conf hostapd.eap_user hostapd.wpa_psk
22.endif
23
24CFLAGS+= -I${.CURDIR} -I${HOSTAPD_DISTDIR}
25CFLAGS+= -DCONFIG_DRIVER_BSD
26CFLAGS+= -DCONFIG_CTRL_IFACE
27CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX
28.if ${MK_INET6} != "no"
29CFLAGS+= -DCONFIG_IPV6
30.endif
31CFLAGS+= -g
32DPADD+=	${LIBPCAP}
33LDADD+=	-lpcap
34
35# User customizations for wpa_supplicant/hostapd build environment
36CFLAGS+=${WPA_SUPPLICANT_CFLAGS}
37#DPADD+=${WPA_SUPPLICANT_DPADD}
38LDADD+=${WPA_SUPPLICANT_LDADD}
39#LDFLAGS+=${WPA_SUPPLICANT_LDFLAGS}
40
41.if !empty(CFLAGS:M*-DEAP_SERVER)
42SRCS+=	eap.c eap_methods.c eap_identity.c
43
44.if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH)
45
46CFLAGS+=-DEAP_TLS -DEAP_PEAP -DEAP_MSCHAPv2 -DEAP_PSK \
47	-DEAP_TLV -DEAP_TLS_FUNCS -DEAP_TLS_OPENSSL
48SRCS+=	eap_tls.c eap_peap.c eap_mschapv2.c \
49	eap_psk.c eap_psk_common.c \
50	eap_tlv.c eap_tls_common.c tls_openssl.c ms_funcs.c crypto.c
51
52CFLAGS+=-DEAP_TTLS -DEAP_MD5
53SRCS+=	eap_ttls.c eap_md5.c
54
55.if !empty(CFLAGS:M*-DEAP_GTC)
56SRCS+=	eap_gtc.c
57.endif
58
59.if !empty(CFLAGS:M*-DEAP_AKA)
60NEED_SIM_COMMON=	true
61SRCS+=	eap_aka.c
62.endif
63
64.if !empty(CFLAGS:M*-DEAP_SIM)
65NEED_SIM_COMMON=	true
66SRCS+=	eap_sim.c
67.endif
68
69.if defined(NEED_SIM_COMMON)
70SRCS+=	eap_sim_common.c eap_sim_db.c
71.endif
72
73.if !empty(CFLAGS:M*-DEAP_GPSK)
74CFLAGS+=-DEAP_GPSK_SHA256
75SRCS+=	eap_gpsk.c eap_gpsk_common.c
76NEED_SHA256=	true
77.endif
78
79.if !empty(CFLAGS:M*-DEAP_PAX)
80SRCS+=	eap_pax.c eap_pax_common.c
81.endif
82
83.if !empty(CFLAGS:M*-DEAP_SAKE)
84SRCS+=	eap_sake.c eap_sake_common.c
85.endif
86
87DPADD+= ${LIBSSL} ${LIBCRYPTO}
88LDADD+= -lssl -lcrypto
89.else
90NEED_TLS_NONE=	true
91.endif
92
93.else
94NEED_TLS_NONE=	true
95.endif
96
97.if defined(NEED_SHA256)
98CFLAGS+=-DINTERNAL_SHA256
99SRCS+=	sha256.c
100.endif
101
102.if defined(NEED_TLS_NONE)
103CFLAGS+= -DEAP_TLS_NONE
104CFLAGS+= -DINTERNAL_AES
105CFLAGS+= -DINTERNAL_SHA1
106CFLAGS+= -DINTERNAL_MD5
107SRCS+=	tls_none.c
108.endif
109
110driver_conf.c: Makefile
111	rm -f driver_conf.c
112	echo '/* THIS FILE AUTOMATICALLY GENERATED, DO NOT EDIT! */' \
113							> driver_conf.c
114	echo '#include <stdlib.h>'			>> driver_conf.c
115	echo '#include <stdio.h>'			>> driver_conf.c
116	echo '#include <sys/types.h>'			>> driver_conf.c
117	echo '#include <netinet/in.h>'			>> driver_conf.c
118	echo '#include "hostapd.h"'			>> driver_conf.c
119	echo '#include "driver.h"'			>> driver_conf.c
120	echo "void bsd_driver_register(void);"		>> driver_conf.c
121	echo 'void register_drivers(void) {'		>> driver_conf.c
122	echo "bsd_driver_register();"			>> driver_conf.c
123	echo '}'					>> driver_conf.c
124
125.include <bsd.prog.mk>
126