Define SRCTOP in src.sys.mk

Use SRCTOP to replace .../ in MAKSYSPATH (avoid extra :tA)
Use SRCTOP rather than ROOTSRCDIR in src.libnames.mk
Merge from head
This commit is contained in:
Simon J. Gerraty 2015-05-26 21:41:26 +00:00
parent 71edef51db
commit ae3019ca08
3 changed files with 407 additions and 60 deletions

View File

@ -7,56 +7,363 @@
.error src.libnames.mk cannot be included directly.
.endif
.if defined(OBJTOP)
ROOTOBJDIR= ${OBJTOP}
.else
ROOTOBJDIR= ${.OBJDIR:S/${.CURDIR}//}${.MAKE.MAKEFILES:M*/src.libnames.mk:H:H:H}
.include <src.opts.mk>
.if defined(MAKEOBJDIRPREFIX) && ${.OBJDIR:M${MAKEOBJDIRPREFIX}/*} != ""
ROOTOBJDIR= ${.OBJDIR:S/${.CURDIR}//}${SRCTOP}
.elif defined(OBJTOP) && ${.OBJDIR:M${OBJTOP}*} != ""
ROOTOBJDIR= ${OBJTOP}
.endif
LIBATF_CDIR= ${ROOTOBJDIR}/lib/atf/libatf-c
LDATF_C?= ${LIBATF_CDIR}/libatf-c.so
LIBATF_C?= ${LIBATF_CDIR}/libatf-c.a
_PRIVATELIBS= \
atf_c \
atf_cxx \
bsdstat \
event \
heimipcc \
heimipcs \
ldns \
sqlite3 \
ssh \
ucl \
unbound
LIBATF_CXXDIR= ${ROOTOBJDIR}/lib/atf/libatf-c++
LDATF_CXX?= ${LIBATF_CXXDIR}/libatf-c++.so
LIBATF_CXX?= ${LIBATF_CXXDIR}/libatf-c++.a
_INTERNALLIBS= \
amu \
bsnmptools \
cron \
elftc \
fifolog \
ipf \
lpr \
netbsd \
ntp \
ntpevent \
ohash \
opts \
parse \
readline \
sl \
sm \
smdb \
smutil \
telnet \
vers
LIBBSDSTATDIR= ${ROOTOBJDIR}/lib/libbsdstat
LDBSDSTAT?= ${LIBBSDSTATDIR}/libbsdstat.so
LIBBSDSTAT?= ${LIBBSDSTATDIR}/libbsdstat.a
_LIBRARIES= \
${_PRIVATELIBS} \
${_INTERNALLIBS} \
alias \
archive \
asn1 \
auditd \
begemot \
bluetooth \
bsdxml \
bsm \
bsnmp \
bz2 \
c \
c_pic \
calendar \
cam \
capsicum \
casper \
com_err \
compiler_rt \
crypt \
crypto \
ctf \
cuse \
cxxrt \
devctl \
devinfo \
devstat \
dialog \
dpv \
dtrace \
dwarf \
edit \
elf \
execinfo \
fetch \
figpar \
geom \
gnuregex \
gpio \
gssapi \
gssapi_krb5 \
hdb \
heimbase \
heimntlm \
heimsqlite \
hx509 \
ipsec \
jail \
kadm5clnt \
kadm5srv \
kafs5 \
kdc \
kiconv \
krb5 \
kvm \
l \
lzma \
m \
magic \
md \
memstat \
mp \
mt \
nandfs \
ncurses \
ncursesw \
netgraph \
ngatm \
nv \
opie \
pam \
pcap \
pcsclite \
pjdlog \
pmc \
proc \
procstat \
pthread \
radius \
readline \
roken \
rpcsec_gss \
rpcsvc \
rt \
rtld_db \
sbuf \
sdp \
sm \
smb \
ssl \
ssp_nonshared \
stdthreads \
supcplusplus \
tacplus \
termcapw \
ufs \
ugidfw \
ulog \
usb \
usbhid \
util \
vmmapi \
wind \
wrap \
xo \
y \
ypclnt \
z
LIBEVENTDIR= ${ROOTOBJDIR}/lib/libevent
LDEVENT?= ${LIBEVENTDIR}/libevent.so
LIBEVENT?= ${LIBEVENTDIR}/libevent.a
_DP_archive= z bz2 lzma bsdxml
.if ${MK_OPENSSL} != "no"
_DP_archive+= crypto
.else
_DP_archive+= md
.endif
_DP_ssl= crypto
_DP_ssh= crypto crypt
.if ${MK_LDNS} != "no"
_DP_ssh+= ldns z
.endif
_DP_edit= ncursesw
.if ${MK_OPENSSL} != "no"
_DP_bsnmp= crypto
.endif
_DP_geom= bsdxml sbuf
_DP_cam= sbuf
_DP_casper= capsicum nv pjdlog
_DP_capsicum= nv
_DP_pjdlog= util
_DP_opie= md
_DP_usb= pthread
_DP_unbound= pthread
_DP_rt= pthread
.if ${MK_OPENSSL} == "no"
_DP_radius= md
.else
_DP_radius= crypto
.endif
_DP_procstat= kvm util elf
.if ${MK_CXX} == "yes"
.if ${MK_LIBCPLUSPLUS} != "no"
_DP_proc= cxxrt
.else
_DP_proc= supcplusplus
.endif
.endif
.if ${MK_CDDL} != "no"
_DP_proc+= ctf
.endif
_DP_mp= crypto
_DP_memstat= kvm
_DP_magic= z
_DP_mt= bsdxml
_DP_ldns= crypto
.if ${MK_OPENSSL} != "no"
_DP_fetch= ssl crypto
.else
_DP_fetch= md
.endif
_DP_execinfo= elf
_DP_dwarf= elf
_DP_dpv= dialog figpar util
_DP_dialog= ncursesw m
_DP_cuse= pthread
_DP_atf_cxx= atf_c
_DP_devstat= kvm
_DP_pam= radius tacplus opie md util
.if ${MK_KERBEROS} != "no"
_DP_pam+= krb5
.endif
.if ${MK_OPENSSH} != "no"
_DP_pam+= ssh
.endif
.if ${MK_NIS} != "no"
_DP_pam+= ypclnt
.endif
_DP_krb5+= asn1 com_err crypt crypto hx509 roken wind heimbase heimipcc \
pthread
_DP_gssapi_krb5+= gssapi krb5 crypto roken asn1 com_err
_DP_lzma= pthread
_DP_ucl= m
_DP_vmmapi= util
_DP_ctf= z
_DP_proc= rtld_db util
_DP_dtrace= rtld_db pthread
LIBHEIMIPCCDIR= ${ROOTOBJDIR}/kerberos5/lib/libheimipcc
LDHEIMIPCC?= ${LIBHEIMIPCCDIR}/libheimipcc.so
LIBHEIMIPCC?= ${LIBHEIMIPCCDIR}/libheimipcc.a
# Define spacial cases
LDADD_supcplusplus= -lsupc++
LIBATF_C= ${DESTDIR}${LIBDIR}/libprivateatf-c.a
LIBATF_CXX= ${DESTDIR}${LIBDIR}/libprivateatf-c++.a
LDADD_atf_c= -lprivateatf-c
LDADD_atf_cxx= -lprivateatf-c++
LIBHEIMIPCSDIR= ${ROOTOBJDIR}/kerberos5/lib/libheimipcs
LDHEIMIPCS?= ${LIBHEIMIPCSDIR}/libheimipcs.so
LIBHEIMIPCS?= ${LIBHEIMIPCSDIR}/libheimipcs.a
.for _l in ${_PRIVATELIBS}
LIB${_l:tu}?= ${DESTDIR}${LIBDIR}/libprivate${_l}.a
.endfor
LIBLDNSDIR= ${ROOTOBJDIR}/lib/libldns
LDLDNS?= ${LIBLDNSDIR}/libldns.so
LIBLDNS?= ${LIBLDNSDIR}/libldns.a
.for _l in ${_LIBRARIES}
.if ${_INTERNALLIBS:M${_l}}
LDADD_${_l}_L+= -L${LIB${_l:tu}DIR}
.endif
DPADD_${_l}?= ${LIB${_l:tu}}
.if ${_PRIVATELIBS:M${_l}}
LDADD_${_l}?= -lprivate${_l}
.else
LDADD_${_l}?= ${LDADD_${_l}_L} -l${_l}
.endif
.if defined(_DP_${_l}) && defined(NO_SHARED)
.for _d in ${_DP_${_l}}
DPADD_${_l}+= ${DPADD_${_d}}
LDADD_${_l}+= ${LDADD_${_d}}
.endfor
.endif
.endfor
LIBSSHDIR= ${ROOTOBJDIR}/secure/lib/libssh
LDSSH?= ${LIBSSHDIR}/libssh.so
LIBSSH?= ${LIBSSHDIR}/libssh.a
DPADD_atf_cxx+= ${DPADD_atf_c}
LDADD_atf_cxx+= ${LDADD_atf_c}
LIBUNBOUNDDIR= ${ROOTOBJDIR}/lib/libunbound
LDUNBOUND?= ${LIBUNBOUNDDIR}/libunbound.so
LIBUNBOUND?= ${LIBUNBOUNDDIR}/libunbound.a
DPADD_sqlite3+= ${DPADD_pthread}
LDADD_sqlite3+= ${LDADD_pthread}
LIBUCLDIR= ${ROOTOBJDIR}/lib/libucl
LDUCL?= ${LIBUCLDIR}/libucl.so
LIBUCL?= ${LIBUCLDIR}/libucl.a
DPADD_fifolog+= ${DPADD_z}
LDADD_fifolog+= ${LDADD_z}
DPADD_ipf+= ${DPADD_kvm}
LDADD_ipf+= ${LDADD_kvm}
DPADD_mt+= ${DPADD_sbuf}
LDADD_mt+= ${LDADD_sbuf}
DPADD_dtrace+= ${DPADD_ctf} ${DPADD_elf} ${DPADD_proc}
LDADD_dtrace+= ${LDADD_ctf} ${LDADD_elf} ${LDADD_proc}
# The following depends on libraries which are using pthread
DPADD_hdb+= ${DPADD_pthread}
LDADD_hdb+= ${LDADD_pthread}
DPADD_kadm5srv+= ${DPADD_pthread}
LDADD_kadm5srv+= ${LDADD_pthread}
DPADD_krb5+= ${DPADD_pthread}
LDADD_krb5+= ${LDADD_pthread}
DPADD_gssapi_krb5+= ${DPADD_pthread}
LDADD_gssapi_krb5+= ${LDADD_pthread}
.for _l in ${LIBADD}
.if ${_PRIVATELIBS:M${_l}}
USEPRIVATELIB+= ${_l}
.endif
DPADD+= ${DPADD_${_l}:Umissing-dpadd_${_l}}
LDADD+= ${LDADD_${_l}}
.endfor
.if defined(DPADD) && ${DPADD:Mmissing-dpadd_*}
.error Missing ${DPADD:Mmissing-dpadd_*:S/missing-dpadd_//:S/^/DPADD_/} variable add "${DPADD:Mmissing-dpadd_*:S/missing-dpadd_//}" to _LIBRARIES, _INTERNALLIBS, or _PRIVATELIBS and define "${DPADD:Mmissing-dpadd_*:S/missing-dpadd_//:S/^/LIB/:tu}".
.endif
LIBELFTCDIR= ${ROOTOBJDIR}/lib/libelftc
LIBELFTC?= ${LIBELFTCDIR}/libelftc.a
LIBREADLINEDIR= ${ROOTOBJDIR}/gnu/lib/libreadline/readline
LDREADLINE?= ${LIBREADLINEDIR}/libreadline.a
LIBREADLINE?= ${LIBREADLINEDIR}/libreadline.a
LIBOHASHDIR= ${ROOTOBJDIR}/lib/libohash
LDOHASH?= ${LIBOHASHDIR}/libohash.a
LIBOHASH?= ${LIBOHASHDIR}/libohash.a
LIBSMDIR= ${ROOTOBJDIR}/lib/libsm
LIBSM?= ${LIBSMDIR}/libsm.a
LIBSMDBDIR= ${ROOTOBJDIR}/lib/libsmdb
LIBSMDB?= ${LIBSMDBDIR}/libsmdb.a
LIBSMUTILDIR= ${ROOTOBJDIR}/lib/libsmutil
LIBSMUTIL?= ${LIBSMDBDIR}/libsmutil.a
LIBNETBSDDIR?= ${ROOTOBJDIR}/lib/libnetbsd
LIBNETBSD?= ${LIBNETBSDDIR}/libnetbsd.a
LIBVERSDIR?= ${ROOTOBJDIR}/kerberos5/lib/libvers
LIBVERS?= ${LIBVERSDIR}/libvers.a
LIBSLDIR= ${ROOTOBJDIR}/kerberos5/lib/libsl
LIBSL?= ${LIBSLDIR}/libsl.a
LIBIPFDIR= ${ROOTOBJDIR}/sbin/ipf/libipf
LIBIPF?= ${LIBIPFDIR}/libipf.a
LIBTELNETDIR= ${ROOTOBJDIR}/lib/libtelnet
LIBTELNET?= ${LIBIPFDIR}/libtelnet.a
LIBCRONDIR= ${ROOTOBJDIR}/usr.sbin/cron/lib
LIBCRON?= ${LIBCRONDIR}/libcron.a
LIBNTPDIR= ${ROOTOBJDIR}/usr.sbin/ntp/libntp
LIBNTP?= ${LIBNTPDIR}/libntp.a
LIBNTPEVENTDIR= ${ROOTOBJDIR}/usr.sbin/ntp/libntpevent
LIBNTPEVENT?= ${LIBNTPEVENTDIR}/libntpevent.a
LIBOPTSDIR= ${ROOTOBJDIR}/usr.sbin/ntp/libopts
LIBOTPS?= ${LIBOPTSDIR}/libopts.a
LIBPARSEDIR= ${ROOTOBJDIR}/usr.sbin/ntp/libparse
LIBPARSE?= ${LIBPARSEDIR}/libparse.a
LIBLPRDIR= ${ROOTOBJDIR}/usr.sbin/lpr/common_source
LIBLPR?= ${LIBOPTSDIR}/liblpr.a
LIBFIFOLOGDIR= ${ROOTOBJDIR}/usr.sbin/fifolog/lib
LIBFIFOLOG?= ${LIBOPTSDIR}/libfifolog.a
LIBBSNMPTOOLSDIR= ${ROOTOBJDIR}/usr.sbin/bsnmpd/tools/libbsnmptools
LIBBSNMPTOOLS?= ${LIBBSNMPTOOLSDIR}/libbsnmptools.a
LIBAMUDIR= ${ROOTOBJDIR}/usr.sbin/amd/libamu
LIBAMU?= ${LIBAMUDIR}/libamu/libamu.a

View File

@ -11,7 +11,7 @@
# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
# to omit from that make.
#
# Makefiles must include bsd.srcpot.mk before they test the value of any MK_FOO
# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO
# variable.
#
# Makefiles may also assume that this file is included by src.opts.mk should it
@ -52,16 +52,22 @@ __DEFAULT_YES_OPTIONS = \
ATM \
AUDIT \
AUTHPF \
AUTOFS \
BHYVE \
BINUTILS \
BINUTILS_BOOTSTRAP \
BLUETOOTH \
BOOT \
BOOTPARAMD \
BOOTPD \
BSD_CPIO \
BSDINSTALL \
BSNMP \
BZIP2 \
CALENDAR \
CAPSICUM \
CASPER \
CCD \
CDDL \
CPP \
CROSS_COMPILER \
@ -73,29 +79,36 @@ __DEFAULT_YES_OPTIONS = \
DMAGENT \
DYNAMICROOT \
ED_CRYPTO \
EE \
ELFTOOLCHAIN_TOOLS \
EXAMPLES \
FDT \
FILE \
FINGER \
FLOPPY \
FMTREE \
FORTH \
FP_LIBC \
FREEBSD_UPDATE \
FTP \
GAMES \
GCOV \
GDB \
GNU \
GNU_GREP_COMPAT \
GPIB \
GPIO \
GPL_DTC \
GROFF \
HAST \
HTML \
HYPERV \
ICONV \
INET \
INET6 \
INETD \
IPFILTER \
IPFW \
ISCSI \
JAIL \
KDUMP \
KVM \
@ -128,7 +141,9 @@ __DEFAULT_YES_OPTIONS = \
PORTSNAP \
PPP \
QUOTAS \
RADIUS_SUPPORT \
RCMDS \
RBOOTD \
RCS \
RESCUE \
ROUTED \
@ -139,13 +154,16 @@ __DEFAULT_YES_OPTIONS = \
SOURCELESS_HOST \
SOURCELESS_UCODE \
SVNLITE \
SYSCALL_COMPAT \
SYSCONS \
SYSINSTALL \
TALK \
TCP_WRAPPERS \
TCSH \
TELNET \
TESTS \
TEXTPROC \
TFTP \
TIMED \
UNBOUND \
USB \
UTMPX \
@ -169,9 +187,8 @@ __DEFAULT_NO_OPTIONS = \
OPENSSH_NONE_CIPHER \
SHARED_TOOLCHAIN \
SORT_THREADS \
SVN \
STALE_STAGED \
SYSROOT
SVN
#
# Default behaviour of some options depends on the architecture. Unfortunately
@ -192,25 +209,36 @@ __TT=${TARGET}
.else
__TT=${MACHINE}
.endif
# Clang is only for x86, powerpc and little-endian arm right now, by default.
.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
.elif ${__TT} == "arm" && ${__T:Marm*eb*} == ""
__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP
# GCC is unable to build the full clang on arm, disable it by default.
__DEFAULT_NO_OPTIONS+=CLANG_FULL
.else
__DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
.endif
# Clang the default system compiler only on little-endian arm and x86.
.if ${__T} == "amd64" || (${__TT} == "arm" && ${__T:Marm*eb*} == "") || \
${__T} == "i386"
__DEFAULT_YES_OPTIONS+=CLANG_IS_CC
__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
.else
# If clang is not cc, then build gcc by default
__DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG CLANG_BOOTSTRAP
.include <bsd.compiler.mk>
.if !${COMPILER_FEATURES:Mc++11}
# If the compiler is not C++11 capable, disable clang and use gcc instead.
__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
.elif ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386"
# On x86 and arm64, clang is enabled, and will be installed as the default cc.
__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
.elif ${__TT} == "arm" && ${__T:Marm*eb*} == ""
# On little-endian arm, clang is enabled, and it is installed as the default
# cc, but since gcc is unable to build the full clang, disable it by default.
__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC
__DEFAULT_NO_OPTIONS+=CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
.elif ${__T:Mpowerpc*}
# On powerpc, clang is enabled, but gcc is installed as the default cc.
__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
__DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC
.else
# Everything else disables clang, and uses gcc instead.
__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
__DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC
.endif
.if ${__T} == "aarch64"
BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB
.endif
# LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5
.if ${__T} == "arm" || ${__T} == "armeb"
BROKEN_OPTIONS+=LLDB
.endif
.include <bsd.mkopt.mk>
@ -218,7 +246,6 @@ __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
#
# MK_* options that default to "yes" if the compiler is a C++11 compiler.
#
.include <bsd.compiler.mk>
.for var in \
LIBCPLUSPLUS
.if !defined(MK_${var})

View File

@ -5,9 +5,22 @@
# to preserve historical (and useful) behavior. Changes here need to
# be reflected there so SRCCONF isn't included multiple times.
# make sure this is defined in a consistent manner
SRCTOP:= ${.PARSEDIR:tA:H:H}
# Allow user to configure things that only effect src tree builds.
SRCCONF?= /etc/src.conf
.if (exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && !target(_srcconf_included_)
.sinclude "${SRCCONF}"
_srcconf_included_: .NOTMAIN
.endif
# If we were found via .../share/mk we need to replace that in
# with ${SRCTOP} so that we can be found by
# sub-makes launched from objdir.
.if ${.MAKEFLAGS:M.../share/mk} != ""
.MAKEFLAGS:= ${.MAKEFLAGS:S,.../share/mk,${SRCTOP}/share/mk,}
.endif
.if ${MAKESYSPATH:Uno:M*.../*} != ""
MAKESYSPATH:= ${MAKESYSPATH:S,.../share/mk,${SRCTOP}/share/mk,}
.export MAKESYSPATH
.endif