freebsd-dev/usr.sbin/wpa/Makefile.inc
Cy Schubert 25ecdc7d52 wpa: Restructure wpa build
The current WPA build assumes a flat namespace. However the latest sources
from w1.fi now have a duplicate config.c, in two separate subdirectories.
The flat namespace will overwrite config.o with the output from the most
recently modified config.c, of which there are two of them.

This commit resolves this problem by building each component in
wpa's src subdirectory tree into its own .a archive, just as the w1.fi
upstream build as used by the port does. The advantages of this approach
are:

1. Duplicate source file names, i.e. config.c in the wpa_supplicant
   direcory and another config.c in src/utils in the next wpa
   will result in both compiles writing to the same .o file.

2. This restructure simplifies maintanence. A develper needs only to add
   new files as identified by git status in the vendor branch to the
   appropriate Makefile within the usr.sbin/wpa tree. This also reduces
   time required to prepare a new import and should reduce error.

3. The new wpa build structure more closely represents the build as
   performed by the upstream tarball.

This is in preparation for the next wpa update from w1.fi.

Reviewed by:	philip
Tested by:	philip
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D30372
2021-05-31 19:39:16 -07:00

100 lines
2.1 KiB
Makefile

# $FreeBSD$
.include <src.opts.mk>
BINDIR?= /usr/sbin
WARNS?= 0
WPA_DISTDIR?= ${SRCTOP}/contrib/wpa/
WPA_SUPPLICANT_DISTDIR?=${WPA_DISTDIR}/wpa_supplicant
HOSTAPD_DISTDIR?= ${WPA_DISTDIR}/hostapd
.PATH.c:${.CURDIR:H}
CFLAGS+=-I${.CURDIR}
CFLAGS+=-I${HOSTAPD_DISTDIR}
CFLAGS+=-I${WPA_DISTDIR}/src
CFLAGS+=-I${WPA_DISTDIR}/src/common
CFLAGS+=-I${WPA_DISTDIR}/src/crypto
CFLAGS+=-I${WPA_DISTDIR}/src/drivers
CFLAGS+=-I${WPA_DISTDIR}/src/l2_packet
CFLAGS+=-I${WPA_DISTDIR}/src/utils
CFLAGS+=-I${WPA_DISTDIR}/src/wps
CFLAGS+=-DCONFIG_DRIVER_BSD
CFLAGS+=-DCONFIG_DRIVER_WIRED
CFLAGS+=-DCONFIG_DRIVER_RADIUS_ACL
CFLAGS+=-DCONFIG_CTRL_IFACE
CFLAGS+=-DCONFIG_CTRL_IFACE_UNIX
CFLAGS+=-DCONFIG_IEEE80211AC
CFLAGS+=-DCONFIG_IEEE80211N
CFLAGS+=-DCONFIG_IEEE80211R
CFLAGS+=-DCONFIG_IEEE80211W
CFLAGS+=-DCONFIG_IEEE80211AX
CFLAGS+=-DNEED_AP_MLME
CFLAGS+=-DTLS_DEFAULT_CIPHERS=\"DEFAULT:!EXP:!LOW\"
CFLAGS+=-DCONFIG_DEBUG_SYSLOG
CFLAGS+=-DCONFIG_WPS
CFLAGS+=-DCONFIG_WPS2
CFLAGS+=-DCONFIG_WPS_UPNP
CFLAGS+=-DCONFIG_WPS_OOB
CFLAGS+=-DCONFIG_INTERWORKING
CFLAGS+=-DPKCS12_FUNCS
CFLAGS+=-DCONFIG_GAS
CFLAGS+=-DCONFIG_PEERKEY
CFLAGS+=-DCONFIG_PRIVSEP
CFLAGS+=-DCONFIG_SMARTCARD
CFLAGS+=-DCONFIG_TERMINATE_ONLASTIF
CFLAGS+=-DCONFIG_TLS=openssl
CFLAGS+=-DCONFIG_MATCH_IFACE
CFLAGS+=-DEAP_SERVER
CFLAGS+=-DEAP_SERVER_GTC
CFLAGS+=-DEAP_SERVER_IDENTITY
CFLAGS+=-DEAP_SERVER_MD5
CFLAGS+=-DEAP_SERVER_MSCHAPV2
CFLAGS+=-DEAP_SERVER_PEAP
CFLAGS+=-DEAP_SERVER_TLS
CFLAGS+=-DEAP_SERVER_TTLS
CFLAGS+=-DEAP_SERVER_WSC
CFLAGS+=-DEAP_TLS_FUNCS
.if ${MK_WPA_SUPPLICANT_EAPOL} != "no"
CFLAGS+=-DCONFIG_HS20 \
-DEAP_GTC \
-DEAP_LEAP \
-DEAP_MD5 \
-DEAP_MSCHAPv2 \
-DEAP_OTP \
-DEAP_PEAP \
-DEAP_PSK \
-DEAP_TLS \
-DEAP_TTLS \
-DEAP_WSC \
-DIEEE8021X_EAPOL
NEED_AES_EAX=y
NEED_AES_ENCBLOCK=y
NEED_AES_OMAC1=y
.endif
.if !empty(CFLAGS:M*-DEAP_AKA)
NEED_SIM_COMMON=y
NEED_AES_CBC=y
.endif
.if !empty(CFLAGS:M*-DEAP_SIM)
NEED_SIM_COMMON=y
NEED_AES_CBC=y
.endif
.if defined(NEED_SIM_COMMON)
NEED_FIPS186_2_PRF=y
.endif
.if !empty(CFLAGS:M*-DEAP_GPSK)
CFLAGS+=-DEAP_GPSK_SHA256
NEED_AES_OMAC1=y
.endif
.include <bsd.own.mk>