diff options
authorBryan Drewery <bdrewery@FreeBSD.org>2016-01-07 00:19:03 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2016-01-07 00:19:03 +0000
commit3ba0785a742f0a29c3869f52bd99e6b5b8b9c0e0 (patch)
parentdbecd1bfdf736d7fff457b6f6e28f43365cb1dfa (diff)
Move the MAKEOBJDIRPREFIX value guard to sys.mk and expand to MAKEOBJDIR.
This will ensure that the variable was not set as a make override, in make.conf, src.conf or src-env.conf. It allows setting the value in src-env.conf when using WITH_AUTO_OBJ since that case properly handles changing .OBJDIR (except if MAKEOBJDIRPREFIX does not yet exist which is being discussed to be changed). This change allows setting a default MAKEOBJDIRPREFIX via local.sys.env.mk. Sponsored by: EMC / Isilon Storage Division
Notes: svn path=/head/; revision=293286
2 files changed, 19 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 836097b42389..c9b8a0a11bc0 100644
--- a/Makefile
+++ b/Makefile
@@ -143,13 +143,6 @@ TGTS+= ${BITGTS}
PATH= /sbin:/bin:/usr/sbin:/usr/bin
-_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
- -f /dev/null -V MAKEOBJDIRPREFIX dummy
-.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
- (in make.conf(5)) or command-line variable.
# We often need to use the tree's version of make to build it.
# Choices add to complexity though.
diff --git a/share/mk/sys.mk b/share/mk/sys.mk
index 51f2818480d7..d8fc057b12db 100644
--- a/share/mk/sys.mk
+++ b/share/mk/sys.mk
@@ -33,6 +33,13 @@ __ENV_ONLY_OPTIONS:= \
+.for _var in ${__ENV_ONLY_VARS}
+_pre_includes_${_var:tl}:= ${${_var}:U__null}
# early include for customization
# see local.sys.mk below
# Not included when building in fmake compatibility mode (still needed
@@ -50,6 +57,9 @@ __ENV_ONLY_OPTIONS:= \
.if ${MK_AUTO_OBJ} == "yes"
+# Reset, since it is allowed to be set from src-env.conf included before this.
+_pre_includes_makeobjdirprefix:= ${MAKEOBJDIRPREFIX:U__null}
+_pre_includes_makeobjdir:= ${MAKEOBJDIR:U__null}
# This needs to be done early - before .PATH is computed
# Don't do this for 'make showconfig' as it enables all options where meta mode
# is not expected.
@@ -410,6 +420,15 @@ __MAKE_SHELL?=/bin/sh
+# Ensure MAKEOBJDIRPREFIX was not incorrectly set.
+.for _var in ${__ENV_ONLY_VARS}
+.if ${.MAKEOVERRIDES:M${_var}} || (defined(${_var}) && \
+ ${${_var}} != ${_pre_includes_${_var:tl}})
+.error ${_var} can only be set in environment, not as a global (in make.conf(5)) or command-line variable.
+.undef _pre_includes_${_var:tl}
# Hack for ports compatibility. Historically, ports makefiles have
# assumed they can examine MACHINE_CPU without including anything
# because this was automatically included in sys.mk. For /usr/src,