From e22224a5c2d2d492e5f93fb96390e37b99c6bbe3 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Tue, 5 Dec 2017 21:29:47 +0000 Subject: [PATCH] AUTO_OBJ: For all top-level targets enforce using an OBJDIR. This will cause an error if the wanted OBJDIR is not writable. Previously it would cause the files to generate to the source tree. This was too obscure and things like buildworld really expect a proper OBJDIR layout. Sponsored by: Dell EMC --- Makefile.sys.inc | 4 ++++ share/mk/src.sys.obj.mk | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile.sys.inc b/Makefile.sys.inc index 6bb597de2fd7..c659234e9dff 100644 --- a/Makefile.sys.inc +++ b/Makefile.sys.inc @@ -38,6 +38,10 @@ MK_AUTO_OBJ= no # just want to read any existing OBJDIR but we don't care if we can create # or write to them. .MAKEOVERRIDES+= MK_AUTO_OBJ +.else +# For top-level we always assume the MAKEOBJDIRPREFIX is writable rather than +# falling back to .CURDIR. +__objdir_writable= yes .endif .endif # empty(.MAKEOVERRIDES:MMK_AUTO_OBJ) diff --git a/share/mk/src.sys.obj.mk b/share/mk/src.sys.obj.mk index 280150b6c7ad..efed181d5c7a 100644 --- a/share/mk/src.sys.obj.mk +++ b/share/mk/src.sys.obj.mk @@ -172,7 +172,7 @@ CheckAutoObj() { \ .if !empty(__objdir) .if ${.CURDIR} == ${__objdir} __objdir_writable?= yes -.else +.elif empty(__objdir_writable) __objdir_writable!= \ ${CheckAutoObj}; CheckAutoObj "${__objdir}" || echo no .endif