Allow 'make buildenv' to work anywhere in the src tree.

Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
bdrewery 2015-11-05 22:28:31 +00:00
parent f85ce54a01
commit 777135d213
3 changed files with 18 additions and 3 deletions

View File

@ -773,7 +773,7 @@ buildworld_epilogue:
# modification of the current environment's PATH. In addition, we need
# to quote multiword values.
#
buildenvvars:
buildenvvars: .PHONY
@echo ${WMAKEENV:Q} ${.MAKE.EXPORTED:@v@$v=\"${$v}\"@}
.if ${.TARGETS:Mbuildenv}
@ -781,9 +781,11 @@ buildenvvars:
.error The buildenv target is incompatible with -j
.endif
.endif
buildenv:
BUILDENV_DIR?= ${.CURDIR}
buildenv: .PHONY
@echo Entering world for ${TARGET_ARCH}:${TARGET}
@cd ${.CURDIR} && env ${WMAKEENV} BUILDENV=1 ${BUILDENV_SHELL} || true
@cd ${BUILDENV_DIR} && env ${WMAKEENV} BUILDENV=1 ${BUILDENV_SHELL} \
|| true
TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
toolchain: ${TOOLCHAIN_TGTS}

View File

@ -38,3 +38,5 @@ CPP= ${HOST_CPP}
HOST_CFLAGS+= -DHOSTPROG
CFLAGS+= ${HOST_CFLAGS}
.endif
.-include "src.init.mk"

11
share/mk/src.init.mk Normal file
View File

@ -0,0 +1,11 @@
# $FreeBSD$
.if !target(__<src.init.mk>__)
__<src.init.mk>__:
.if !target(buildenv)
buildenv: .PHONY
@env BUILDENV_DIR=${.CURDIR} ${MAKE} -C ${SRCTOP} buildenv
.endif
.endif # !target(__<src.init.mk>__)