diff --git a/Makefile b/Makefile index 51bd582efda0..67406a7c7089 100644 --- a/Makefile +++ b/Makefile @@ -85,6 +85,12 @@ TGTS+= ${BITGTS} PATH= /sbin:/bin:/usr/sbin:/usr/bin MAKEOBJDIRPREFIX?= /usr/obj +_MAKEOBJDIRPREFIX!= env -i PATH=${PATH} MAKEFLAGS="${.MAKEFLAGS}" ${MAKE} \ + -f /dev/null -V MAKEOBJDIRPREFIX dummy +.if !empty(_MAKEOBJDIRPREFIX) +.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\ + (in /etc/make.conf) or command-line variable. +.endif MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE} BINMAKE= \ `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \ diff --git a/Makefile.inc1 b/Makefile.inc1 index 2290adf8c4fd..5b1ffb6a8ff0 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -90,13 +90,6 @@ SUPFLAGS+= -h ${SUPHOST} .endif MAKEOBJDIRPREFIX?= /usr/obj -_MAKEOBJDIRPREFIX!= env -i PATH=${PATH} MAKEFLAGS="${.MAKEFLAGS}" ${MAKE} \ - -f /dev/null -V MAKEOBJDIRPREFIX dummy -.if !empty(_MAKEOBJDIRPREFIX) -.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\ - (in /etc/make.conf) or command-line variable. -.endif - .if !defined(OSRELDATE) .if exists(/usr/include/osreldate.h) OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \