From 208f108362680e4b4486c28f103006e6678504e2 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Thu, 5 Nov 2015 22:28:31 +0000 Subject: [PATCH] Allow 'make buildenv' to work anywhere in the src tree. Sponsored by: EMC / Isilon Storage Division --- Makefile.inc1 | 8 +++++--- share/mk/local.init.mk | 2 ++ share/mk/src.init.mk | 11 +++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 share/mk/src.init.mk diff --git a/Makefile.inc1 b/Makefile.inc1 index 3c5ff9320336..48fef50791f6 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -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} diff --git a/share/mk/local.init.mk b/share/mk/local.init.mk index 85303c381bae..a30ed0e7085a 100644 --- a/share/mk/local.init.mk +++ b/share/mk/local.init.mk @@ -38,3 +38,5 @@ CPP= ${HOST_CPP} HOST_CFLAGS+= -DHOSTPROG CFLAGS+= ${HOST_CFLAGS} .endif + +.-include "src.init.mk" diff --git a/share/mk/src.init.mk b/share/mk/src.init.mk new file mode 100644 index 000000000000..437489eb6ab6 --- /dev/null +++ b/share/mk/src.init.mk @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.if !target(____) +____: + +.if !target(buildenv) +buildenv: .PHONY + @env BUILDENV_DIR=${.CURDIR} ${MAKE} -C ${SRCTOP} buildenv +.endif + +.endif # !target(____)