Re: git: 2b7c1402f96b - main - src.sys.obj.mk: Export OBJTOP

From: Mark Johnston <markj_at_freebsd.org>
Date: Sun, 02 Jun 2024 23:04:40 UTC
On Tue, May 28, 2024 at 06:52:50PM +0000, Simon J. Gerraty wrote:
> The branch main has been updated by sjg:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=2b7c1402f96be2d2986738e32706dab7b5691ef0
> 
> commit 2b7c1402f96be2d2986738e32706dab7b5691ef0
> Author:     Simon J. Gerraty <sjg@FreeBSD.org>
> AuthorDate: 2024-05-28 18:51:31 +0000
> Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
> CommitDate: 2024-05-28 18:51:31 +0000
> 
>     src.sys.obj.mk: Export OBJTOP
>     
>     If we had to set OBJTOP we want to .export it (if .MAKE.LEVEL > 0)
>     for the benefit of things like x!= ${.MAKE} -r ... and similar.
>     
>     Without OBJTOP, the default MAKEOBJDIR setting will result in
>     attempting to use an objdir like /lib or /bin etc in some cases.
>     
>     This patch is based on D30990
>     with the addition of the check for level > 0.
>     
>     Reviewed by: jrtc27
>     Differential Revision:        <https://reviews.freebsd.org/D30990>

Hi Simon,

This breaks "make -j<big number> kernels" for me.  The parallel kernel
builds appear to share an object directory and step all over each other.
This happens with and without the level > 0 check.

> ---
>  share/mk/src.sys.obj.mk | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/share/mk/src.sys.obj.mk b/share/mk/src.sys.obj.mk
> index 708559edcdb8..e4c31f746f3d 100644
> --- a/share/mk/src.sys.obj.mk
> +++ b/share/mk/src.sys.obj.mk
> @@ -94,6 +94,9 @@ OBJTOP:=	${OBJROOT}${MACHINE}.${MACHINE_ARCH}
>  # TARGET.TARGET_ARCH handled in OBJROOT already.
>  OBJTOP:=	${OBJROOT:H}
>  .endif	# ${MK_UNIFIED_OBJDIR} == "yes"
> +.if ${.MAKE.LEVEL} > 0
> +.export OBJTOP
> +.endif
>  .endif	# empty(OBJTOP)
>  
>  # Fixup OBJROOT/OBJTOP if using MAKEOBJDIRPREFIX.
>