Move some objdir handling (OBJROOT/OBJTOP) out of DIRDEPS_BUILD-only files.

Sponsored by:	Dell EMC Isilon
This commit is contained in:
Bryan Drewery 2017-10-31 00:26:42 +00:00
parent 95137b228e
commit 0dd60f15a5
2 changed files with 41 additions and 29 deletions

View File

@ -7,36 +7,10 @@
# we need this until there is an alternative
MK_INSTALL_AS_USER= yes
_default_makeobjdir=$${.CURDIR:S,^$${SRCTOP},$${OBJTOP},}
.if empty(OBJROOT) || ${.MAKE.LEVEL} == 0
.if defined(MAKEOBJDIRPREFIX) && !empty(MAKEOBJDIRPREFIX)
# put things approximately where they want
OBJROOT:=${MAKEOBJDIRPREFIX}${SRCTOP}/
MAKEOBJDIRPREFIX=
.export MAKEOBJDIRPREFIX
.endif
.if empty(MAKEOBJDIR)
# OBJTOP set below
MAKEOBJDIR=${_default_makeobjdir}
# export but do not track
.export-env MAKEOBJDIR
# Expand for our own use
MAKEOBJDIR:= ${MAKEOBJDIR}
.endif
.if !empty(SB)
SB_OBJROOT ?= ${SB}/obj/
# this is what we use below
OBJROOT ?= ${SB_OBJROOT}
.endif
OBJROOT ?= /usr/obj${SRCTOP}/
.if ${OBJROOT:M*/} != ""
OBJROOT:= ${OBJROOT:H:tA}/
.else
OBJROOT:= ${OBJROOT:H:tA}/${OBJROOT:T}
.endif
.export OBJROOT SRCTOP
# Default OBJROOT/MAKEOBJDIR handled in local.sys.obj.mk
.include <src.sys.obj.mk>
.if !defined(HOST_TARGET)
# we need HOST_TARGET etc below.
.include <host-target.mk>
.export HOST_TARGET

38
share/mk/src.sys.obj.mk Normal file
View File

@ -0,0 +1,38 @@
# $FreeBSD$
_default_makeobjdir= $${.CURDIR:S,^$${SRCTOP},$${OBJTOP},}
.if empty(OBJROOT) || ${.MAKE.LEVEL} == 0
.if defined(MAKEOBJDIRPREFIX) && !empty(MAKEOBJDIRPREFIX)
# put things approximately where they want
OBJROOT:= ${MAKEOBJDIRPREFIX}${SRCTOP}/
MAKEOBJDIRPREFIX=
.export MAKEOBJDIRPREFIX
.endif
.if empty(MAKEOBJDIR)
# OBJTOP set below
MAKEOBJDIR= ${_default_makeobjdir}
# export but do not track
.export-env MAKEOBJDIR
# Expand for our own use
MAKEOBJDIR:= ${MAKEOBJDIR}
.endif
.if !empty(SB)
SB_OBJROOT?= ${SB}/obj/
# this is what we use below
OBJROOT?= ${SB_OBJROOT}
.endif
OBJROOT?= /usr/obj${SRCTOP}/
.if ${OBJROOT:M*/} != ""
OBJROOT:= ${OBJROOT:H:tA}/
.else
OBJROOT:= ${OBJROOT:H:tA}/${OBJROOT:T}
.endif
.export OBJROOT SRCTOP
.endif
.if defined(MAKEOBJDIR)
.if ${MAKEOBJDIR:M/*} == ""
.error Cannot use MAKEOBJDIR=${MAKEOBJDIR}${.newline}Unset MAKEOBJDIR to get default: MAKEOBJDIR='${_default_makeobjdir}'
.endif
.endif