LIBADD: Try to support partial tree checkouts in some limited cases.

LIBADD is only supported for in-tree builds because we do not install
share/mk/src.libnames.mk (which provides LIBADD support) into /usr/share/mk.
So if a partial checkout is done then the LIBADDs are ignored and no LDADD is
ever added.

Provide limited support for this case for when LIBADD is composed entirely of
base libraries.  This is to avoid clashes with ports and other out-of-tree
LIBADD uses that should not be mapped to LDADD and because we do not want to
support LIBADD out-of-tree right now.

Reported by:	mckusick, kib
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
This commit is contained in:
Bryan Drewery 2017-06-20 20:34:30 +00:00
parent aee33af1f1
commit fb40136990
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=320171

View File

@ -194,4 +194,26 @@ LDADD:= ${LDADD:N-lc} -lc
.for lib in ${_LIBRARIES}
LIB${lib:tu}SRCDIR?= ${SRCTOP}/${LIB${lib:tu}DIR:S,^${OBJTOP}/,,}
.endfor
.else
# Out of tree builds
# There are LIBADD defined in an out-of-tree build. Are they *all*
# in-tree libraries? If so convert them to LDADD to support
# partial checkouts.
.if !empty(LIBADD)
_convert_libadd= 1
.for l in ${LIBADD}
.if empty(LIB${l:tu})
_convert_libadd= 0
.endif
.endfor
.if ${_convert_libadd} == 1
.warning Converting out-of-tree build LIBADDs into LDADD. This is not fully supported.
.for l in ${LIBADD}
LDADD+= -l${l}
.endfor
.endif
.endif
.endif # defined(SRCTOP)