META_MODE: Allow MAKEOBJDIRPREFIX to work more closely to its traditional behavior.

The preferred way to modify the object directory root is to use OBJROOT.
However, setting OBJROOT to ${MAKEOBJDIRPREFIX}/${SRCTOP}/ effectively behaves
as expected.

The problem with this before was that setting OBJROOT to contain SRCTOP
resulted in a recursive replacement (/usr/obj/usr/obj/usr/src/). Anchoring to
the start of the path for replacing SRCCTOP in CURDIR resolves this by
avoiding replacing SRCTOP when CURDIR is within the OBJDIR.

Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Bryan Drewery 2015-09-17 04:01:05 +00:00
parent b8303685fa
commit 3c35812126

View File

@ -7,14 +7,13 @@
# we need this until there is an alternative
MK_INSTALL_AS_USER= yes
_default_makeobjdir=$${.CURDIR:S,$${SRCTOP},$${OBJTOP},}
_default_makeobjdir=$${.CURDIR:S,^$${SRCTOP},$${OBJTOP},}
.if empty(OBJROOT) || ${.MAKE.LEVEL} == 0
.if !make(showconfig)
.if defined(MAKEOBJDIRPREFIX) && exists(${MAKEOBJDIRPREFIX})
.warning MAKEOBJDIRPREFIX not supported; setting MAKEOBJDIR...
.if defined(MAKEOBJDIRPREFIX)
# put things approximately where they want
OBJROOT:=${MAKEOBJDIRPREFIX}${SRCTOP:S,/src,,}/
OBJROOT:=${MAKEOBJDIRPREFIX}${SRCTOP}/
MAKEOBJDIRPREFIX=
.export MAKEOBJDIRPREFIX
.endif