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
This commit is contained in:
Kyle Evans 2024-01-08 22:21:36 -06:00
parent cef5e56f3f
commit 5d1ecf0b61

View file

@ -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