git: 5d1ecf0b6184 - main - build: only inspect the first word of toolchain tools

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Tue, 09 Jan 2024 04:22:42 UTC
The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=5d1ecf0b6184748a51bca01b497c808c3e13aa67

commit 5d1ecf0b6184748a51bca01b497c808c3e13aa67
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-01-09 04:21:36 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-01-09 04:22:25 +0000

    build: only inspect the first word of toolchain tools
    
    CC/CXX/CPP/LD may all have arguments supplied in various circumstances,
    which break the logic here.  We only need to determine which of these
    tools we're expecting to invoke from PATH, which just requires
    examination of the first word.  Limit our scope to exactly that.
    
    Patch suggested by:     jrtc27
    Reviewed by:            imp, jrtc27
    Differential Revision:  https://reviews.freebsd.org/D43372
---
 tools/build/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/build/Makefile b/tools/build/Makefile
index 187d5593564d..e60c8694d56d 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -370,9 +370,9 @@ _WRAP_HOST_TOOL=	${_LINK_HOST_TOOL}
 .endif
 .for var in CC CXX CPP LD
 .for X in $${_empty_var_} X
-.if !empty(${X}${var}) && !${${X}${var}:M/*} && \
-	!${_toolchain_tools_to_symlink:U:M${${X}${var}}}
-_toolchain_tools_to_symlink+=	${${X}${var}}
+.if !empty(${X}${var}) && !${${X}${var}:[1]:M/*} && \
+	!${_toolchain_tools_to_symlink:U:M${${X}${var}:[1]}}
+_toolchain_tools_to_symlink+=	${${X}${var}:[1]}
 .endif
 .endfor
 .endfor