AUTO_OBJ: Support SRCS/DPSRCS that contain '/' and require a nested OBJDIR.

This is to be used by the new clang3.9 build and extends functionality
added to 'make obj' in r279980.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
bdrewery 2016-08-30 22:48:05 +00:00
parent 27ece8c45f
commit 7ff669ea6a

View File

@ -51,6 +51,30 @@ CANONICALOBJDIR= ${.OBJDIR}
# but this makefile does not want it!
.OBJDIR: ${.CURDIR}
.endif
# Handle special case where SRCS is full-pathed and requires
# nested objdirs. This duplicates some auto.obj.mk logic.
.if (!empty(SRCS:M*/*) || !empty(DPSRCS:M*/*)) && \
(${.TARGETS} == "" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} != "")
_wantdirs= ${SRCS:M*/*:H} ${DPSRCS:M*/*:H}
.if !empty(_wantdirs)
_wantdirs:= ${_wantdirs:O:u}
_needdirs=
.for _dir in ${_wantdirs}
.if !exists(${.OBJDIR}/${_dir}/)
_needdirs+= ${_dir}
.endif
.endfor
.endif
.if !empty(_needdirs)
#_mkneededdirs!= umask ${OBJDIR_UMASK:U002}; ${Mkdirs} ${_needdirs}
__objdir_made != umask ${OBJDIR_UMASK:U002}; ${Mkdirs}; \
for dir in ${_needdirs}; do \
dir=${.OBJDIR}/$${dir}; \
${ECHO_TRACE} "[Creating nested objdir $${dir}...]" >&2; \
Mkdirs $${dir}; \
done
.endif
.endif # !empty(SRCS:M*/*) || !empty(DPSRCS:M*/*)
.elif defined(MAKEOBJDIRPREFIX)
CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
.elif defined(MAKEOBJDIR) && ${MAKEOBJDIR:M/*} != ""