Enforce the check that MAKEOBJDIRPREFIX (if set) is set in environment

only, and not as a global (in /etc/make.conf) or command-line variable.

MAKEOBJDIRPREFIX has never been a global or command-line variable, and
the fact that it works in some scenarios for "make buildworld" doesn't
make it any more correct.  Using it as a global or command-line variable
is error prone, discouraged, costs us lot of false build reports, etc.

This commit is aimed to fix it once and for all.

Anyone potentially objecting to this change is encouraged to read the
make(1) and make.conf(5) manpages, and the comments regarding the use
of the MAKEOBJDIRPREFIX variable in /usr/share/mk/bsd.obj.mk and
/usr/share/examples/etc/make.conf.
This commit is contained in:
Ruslan Ermilov 2004-08-11 11:02:26 +00:00
parent 767981878c
commit 72e3b0396f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=133483

View File

@ -93,6 +93,13 @@ 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 }' \