From fb401369903f1312a08376a462c3319538dfacfa Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Tue, 20 Jun 2017 20:34:30 +0000 Subject: [PATCH] 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 --- share/mk/bsd.libnames.mk | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk index 0f742d91f1a8..c216f295181a 100644 --- a/share/mk/bsd.libnames.mk +++ b/share/mk/bsd.libnames.mk @@ -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)