svn commit: r330363 - head/share/mk

Bryan Drewery bdrewery at FreeBSD.org
Sat Mar 3 23:23:02 UTC 2018


Author: bdrewery
Date: Sat Mar  3 23:23:01 2018
New Revision: 330363
URL: https://svnweb.freebsd.org/changeset/base/330363

Log:
  Ignore MAKEOBJDIRPREFIX from src-env.conf in sub-makes.
  
  A sub-make, such as in 'make buildworld', may want to override MAKEOBJDIRPREFIX
  but is unable to do so if src-env.conf is forcing it to another value.  Without
  using '?=' the sub-make may use the wrong .OBJDIR.
  
  Reported by:	eadler
  Sponsored by:	Dell EMC

Modified:
  head/share/mk/src.sys.env.mk

Modified: head/share/mk/src.sys.env.mk
==============================================================================
--- head/share/mk/src.sys.env.mk	Sat Mar  3 23:08:49 2018	(r330362)
+++ head/share/mk/src.sys.env.mk	Sat Mar  3 23:23:01 2018	(r330363)
@@ -24,10 +24,38 @@ RELOBJTOP?=	${RELTOP}
 RELSRCTOP?=	${RELTOP}
 
 # site customizations that do not depend on anything!
+
+# Save MAKEOBJDIRPREFIX and don't let src-env.conf modify it.
+# MAKEOBJDIRPREFIX is only needed in MAKELEVEL=0.  In sub-makes it will
+# either be read from environment or OBJDIR/MAKEOBJDIR according to
+# src.sys.obj.mk.
+.if !(${.MAKE.LEVEL} == 0 || empty(OBJROOT))
+.if defined(MAKEOBJDIRPREFIX)
+_saveMAKEOBJDIRPREFIX:=	${MAKEOBJDIRPREFIX}
+.else
+_undefMAKEOBJDIRPREFIX=	t
+.endif
+.endif
+
 SRC_ENV_CONF?= /etc/src-env.conf
 .if !empty(SRC_ENV_CONF) && !target(_src_env_conf_included_)
 .-include "${SRC_ENV_CONF}"
 _src_env_conf_included_:	.NOTMAIN
+.endif
+
+.if defined(_saveMAKEOBJDIRPREFIX) || defined(_undefMAKEOBJDIRPREFIX)
+.if defined(MAKEOBJDIRPREFIX) && ((defined(_saveMAKEOBJDIRPREFIX) && \
+    ${_saveMAKEOBJDIRPREFIX} != ${MAKEOBJDIRPREFIX}) || \
+    defined(_undefMAKEOBJDIRPREFIX))
+.warning ${SRC_ENV_CONF}: Ignoring MAKEOBJDIRPREFIX entry in sub-make.  Use '?=' to avoid this warning.
+.endif
+.if defined(_saveMAKEOBJDIRPREFIX)
+MAKEOBJDIRPREFIX:=	${_saveMAKEOBJDIRPREFIX}
+.undef _saveMAKEOBJDIRPREFIX
+.elif defined(_undefMAKEOBJDIRPREFIX)
+.undef MAKEOBJDIRPREFIX
+.undef _undefMAKEOBJDIRPREFIX
+.endif
 .endif
 
 .include <bsd.mkopt.mk>


More information about the svn-src-all mailing list