Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Nov 2017 00:12:09 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325417 - head/share/mk
Message-ID:  <201711050012.vA50C9wD042997@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Sun Nov  5 00:12:09 2017
New Revision: 325417
URL: https://svnweb.freebsd.org/changeset/base/325417

Log:
  Set the expected __objdir for auto.obj.mk to try.
  
  This avoids some future discrepency that might cause auto.obj.mk to use the
  wrong OBJDIR.
  
  Sponsored by:	Dell EMC Isilon

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

Modified: head/share/mk/src.sys.obj.mk
==============================================================================
--- head/share/mk/src.sys.obj.mk	Sun Nov  5 00:12:05 2017	(r325416)
+++ head/share/mk/src.sys.obj.mk	Sun Nov  5 00:12:09 2017	(r325417)
@@ -94,9 +94,17 @@ OBJROOT:=	${OBJTOP}/
 .endif
 .endif
 
-# Try to enable MK_AUTO_OBJ by default if we can write to the OBJROOT.  Only
-# do this if AUTO_OBJ is not disabled by the user, not cleaning, and this
-# is the first make ran.
+# __objdir is the expected .OBJDIR we want to use and that auto.obj.mk will
+# try to create.
+.if !empty(MAKEOBJDIRPREFIX)
+__objdir:=	${MAKEOBJDIRPREFIX}${.CURDIR}
+.elif !empty(MAKEOBJDIR)
+__objdir:=	${MAKEOBJDIR}
+.endif
+
+# Try to enable MK_AUTO_OBJ by default if we can write to the __objdir.  Only
+# do this if AUTO_OBJ is not disabled by the user, not cleaning, and this is
+# the first make ran.
 .if 0 && ${.MAKE.LEVEL} == 0 && \
     ${MK_AUTO_OBJ} == "no" && empty(.MAKEOVERRIDES:MMK_AUTO_OBJ) && \
     !defined(WITHOUT_AUTO_OBJ) && !make(showconfig) && !make(print-dir) && \
@@ -138,15 +146,13 @@ CheckAutoObj() { \
 		echo no; \
 	fi; \
 }
-.if !empty(MAKEOBJDIRPREFIX)
-WANTED_OBJDIR=	${MAKEOBJDIRPREFIX}${.CURDIR}
-.else
-WANTED_OBJDIR=	${MAKEOBJDIR}
+.if !empty(__objdir)
+__objdir_writable!= \
+	${CheckAutoObj}; CheckAutoObj "${__objdir}" || echo no
 .endif
-OBJDIR_WRITABLE!= \
-	${CheckAutoObj}; CheckAutoObj "${WANTED_OBJDIR}" || echo no
+__objdir_writable?= no
 # Export the decision to sub-makes.
-MK_AUTO_OBJ:=	${OBJDIR_WRITABLE}
+MK_AUTO_OBJ:=	${__objdir_writable}
 .export MK_AUTO_OBJ
 .elif make(showconfig)
 # Need to export for showconfig internally running make -dg1.  It is enabled
@@ -157,10 +163,8 @@ MK_AUTO_OBJ:=	${OBJDIR_WRITABLE}
 # Assign this directory as .OBJDIR if possible.
 #
 # The expected OBJDIR already exists, set it as .OBJDIR.
-.if !empty(MAKEOBJDIRPREFIX) && exists(${MAKEOBJDIRPREFIX}${.CURDIR})
-.OBJDIR: ${MAKEOBJDIRPREFIX}${.CURDIR}
-.elif exists(${MAKEOBJDIR})
-.OBJDIR: ${MAKEOBJDIR}
+.if !empty(__objdir) && exists(${__objdir})
+.OBJDIR: ${__objdir}
 # Special case to work around bmake bug.  If the top-level .OBJDIR does not yet
 # exist and MAKEOBJDIR is passed into environment and yield a blank value,
 # bmake will incorrectly set .OBJDIR=${SRCTOP}/ rather than the expected



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711050012.vA50C9wD042997>