git: 244ecc561601 - stable/13 - Makefile.inc1: Avoid including cwd in path

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Tue, 07 Oct 2025 18:17:05 UTC
The branch stable/13 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=244ecc561601af61c9fca7240a1e5d990b6d3b5f

commit 244ecc561601af61c9fca7240a1e5d990b6d3b5f
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-08-16 16:18:15 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-10-07 18:16:44 +0000

    Makefile.inc1: Avoid including cwd in path
    
    Buildworld failed when objcopy tried to overwrite itself, with `objcopy:
    open objcopy failed: Text file busy`.  The PATH ended up with `::`,
    effectively including the current directory, and we found the wrong
    objcopy.
    
    PR:             261215
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit ac7ed266dc73a1d55f2bc1e90bfce3c93757e8b4)
    (cherry picked from commit e425d433c5adaa0f7a513ba836fa378137ed7be4)
---
 Makefile.inc1 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile.inc1 b/Makefile.inc1
index eaa17139c3cf..3b954936be23 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -607,7 +607,10 @@ XPATH=		${WORLDTMP}/bin:${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin
 # When building we want to find the cross tools before the host tools in ${BPATH}.
 # We also need to add UNIVERSE_TOOLCHAIN_PATH so that we can find the shared
 # toolchain files (clang, lld, etc.) during make universe/tinderbox
-STRICTTMPPATH=	${XPATH}:${BPATH}:${UNIVERSE_TOOLCHAIN_PATH}
+STRICTTMPPATH=	${XPATH}:${BPATH}
+.if defined(UNIVERSE_TOOLCHAIN_PATH)
+STRICTTMPPATH:=${STRICTTMPPATH}:${UNIVERSE_TOOLCHAIN_PATH}
+.endif
 # We should not be using tools from /usr/bin accidentally since this could cause
 # the build to break on other systems that don't have that tool. For now we
 # still allow using the old behaviour (inheriting $PATH) if