Allow 'make buildenv' to default to the caller's shell by using SHELL.

Also pass BUILDENV=1 into the sub-shell to allow modifying PS1 in .profile such
as:
  if [ -n "${BUILDENV}" ]; then
          PS1="(buildenv) ${PS1}"
  fi

SHELL defaults to 'sh' in share/mk/sys.mk, but is typically passed down by
the shell invoking make as well.  Rather than forcing all 'buildenv' users
to use plain /bin/sh, let them use their favorite shell.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
Discussed with:	imp
This commit is contained in:
Bryan Drewery 2015-11-05 22:09:00 +00:00
parent c973c8b228
commit e4fa4fafab
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290423

View File

@ -27,7 +27,7 @@
# when NO_ROOT is set. (default: ${DESTDIR}/METALOG)
# TARGET="machine" to crossbuild world for a different machine type
# TARGET_ARCH= may be required when a TARGET supports multiple endians
# BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh)
# BUILDENV_SHELL= shell to launch for the buildenv target (def:${SHELL})
# WORLD_FLAGS= additional flags to pass to make(1) during buildworld
# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel
# SUBDIR_OVERRIDE="list of dirs" to build rather than everything.
@ -145,7 +145,7 @@ CLEANDIR= cleandir
LOCAL_TOOL_DIRS?=
BUILDENV_SHELL?=/bin/sh
BUILDENV_SHELL?=${SHELL}
SVN?= /usr/local/bin/svn
SVNFLAGS?= -r HEAD
@ -783,7 +783,7 @@ buildenvvars:
.endif
buildenv:
@echo Entering world for ${TARGET_ARCH}:${TARGET}
@cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
@cd ${.CURDIR} && env ${WMAKEENV} BUILDENV=1 ${BUILDENV_SHELL} || true
TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
toolchain: ${TOOLCHAIN_TGTS}