Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 08 Jun 2022 17:40:10 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 233265] 'make -V MAKEOBJDIRPREFIX' at the top of base source tree doesn't work if value of MAKEOBJDIRPREFIX is customized
Message-ID:  <bug-233265-227-blR1YKTQbL@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-233265-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-233265-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D233265

Bryan Drewery <bdrewery@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sjg@FreeBSD.org

--- Comment #1 from Bryan Drewery <bdrewery@FreeBSD.org> ---
This is quite old but yes that change did remove MAKEOBJDIRPREFIX there. The
code was activated / moved from another file and originated from here (for a
different build mode involving MK_DIRDEPS_BUILD):

commit 916c1cd0abd348b515a8ac1e6dc4326eb52bbbed
Author: Simon J. Gerraty <sjg@FreeBSD.org>
Date:   Sat Jun 20 21:48:07 2015 +0000

    Deal with MAKEOBJDIRPREFIX

    MAKEOBJDIRPREFIX does not really fit our model.
    Use it to set OBJROOT to about where user expects
    and set MAKEOBJDIR to do what we want.

Notes:
    svn path=3D/head/; revision=3D284650

diff --git share/mk/local.meta.sys.mk share/mk/local.meta.sys.mk
index 2b7f81d49b82..b3cb2575d457 100644
--- share/mk/local.meta.sys.mk
+++ share/mk/local.meta.sys.mk
@@ -8,6 +8,18 @@
 MK_INSTALL_AS_USER=3D yes

 .if empty(OBJROOT) || ${.MAKE.LEVEL} =3D=3D 0
+.if defined(MAKEOBJDIRPREFIX) && exists(${MAKEOBJDIRPREFIX})
+.warning MAKEOBJDIRPREFIX not supported; setting MAKEOBJDIR...
+# put things approximately where they want
+OBJROOT:=3D${MAKEOBJDIRPREFIX}${SRCTOP:S,/src,,}/
+# OBJTOP set below
+MAKEOBJDIR=3D$${.CURDIR:S,$${SRCTOP},$${OBJTOP},}
+MAKEOBJDIRPREFIX=3D
+# export but do not track
+.export-env MAKEOBJDIRPREFIX MAKEOBJDIR
+# now for our own use
+MAKEOBJDIR=3D ${.CURDIR:S,${SRCTOP},${OBJTOP},}
+.endif
 .if !empty(SB)
 SB_OBJROOT ?=3D ${SB}/obj/
 # this is what we use below




I think the following patch will fix it but it is not fully tested. There a=
re a
lot of complex cases that need testing before committing.

diff --git share/mk/src.sys.obj.mk share/mk/src.sys.obj.mk
index 3b48fc3c5514..236548b5e94b 100644
--- share/mk/src.sys.obj.mk
+++ share/mk/src.sys.obj.mk
@@ -48,9 +48,12 @@ MAKEOBJDIRPREFIX:=3D=20=20
${MAKEOBJDIRPREFIX}${TARGET:D/${TARGET}.${TARGET_ARCH}}
 .if !empty(MAKEOBJDIRPREFIX)
 # put things approximately where they want
 OBJROOT:=3D      ${MAKEOBJDIRPREFIX}${SRCTOP}/
+_saveMAKEOBJDIRPREFIX:=3D ${MAKEOBJDIRPREFIX}
 MAKEOBJDIRPREFIX=3D
 # export but do not track
 .export-env MAKEOBJDIRPREFIX
+MAKEOBJDIRPREFIX:=3D ${_saveMAKEOBJDIRPREFIX}
+.undef _saveMAKEOBJDIRPREFIX
 .endif
 .if empty(MAKEOBJDIR)
 # OBJTOP set below


(I expected '.export-env MAKEOBJDIRPREFIX=3D' to work but it did not. I had=
 to do
the dance above to export a blank value but keep the current value availabl=
e)

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-233265-227-blR1YKTQbL>