Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Nov 2017 00:12:06 +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: r325416 - head/share/mk
Message-ID:  <201711050012.vA50C6m8042948@repo.freebsd.org>

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

Log:
  Always try to set .OBJDIR, even if AUTO_OBJ is enabled, and fallback to .CURDIR.
  
  When AUTO_OBJ is enabled this change becomes redundant with the auto.obj.mk
  check added in r325404.  However, it is possible that new code is added
  at some point between src.sys.obj.mk and auto.obj.mk that disables AUTO_OBJ.
  That could leave make with a bogus and unsafe .OBJDIR in some cases.
  
  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:02 2017	(r325415)
+++ head/share/mk/src.sys.obj.mk	Sun Nov  5 00:12:05 2017	(r325416)
@@ -154,9 +154,8 @@ MK_AUTO_OBJ:=	${OBJDIR_WRITABLE}
 .export MK_AUTO_OBJ
 .endif	# ${MK_AUTO_OBJ} == "no" && ...
 
-# Assign this directory as .OBJDIR if possible after determining if AUTO_OBJ
-# can be enabled by default.
-.if ${MK_AUTO_OBJ} == "no"
+# 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}
@@ -169,5 +168,10 @@ MK_AUTO_OBJ:=	${OBJDIR_WRITABLE}
 .elif ${MAKE_VERSION} <= 20170720 && \
     ${.CURDIR} == ${SRCTOP} && ${.OBJDIR} == ${SRCTOP}/
 .OBJDIR: ${.CURDIR}
+.else
+# The OBJDIR we wanted does not yet exist, ensure we default to safe .CURDIR
+# in case make started with a bogus MAKEOBJDIR, that expanded before OBJTOP
+# was set, that happened to match some unexpected directory.  Either
+# auto.obj.mk or bsd.obj.mk will create the directory and fix .OBJDIR later.
+.OBJDIR: ${.CURDIR}
 .endif
-.endif	# ${MK_AUTO_OBJ} == "no"



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