diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index d93250b33bf6..c1e15a4aee36 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -71,14 +71,10 @@ endef # cc-cross-prefix # Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-) -# Return first prefix where a prefix$(CC) is found in PATH. -# If no $(CC) found in PATH with listed prefixes return nothing -cc-cross-prefix = \ - $(word 1, $(foreach c,$(1), \ - $(shell set -e; \ - if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \ - echo $(c); \ - fi))) +# Return first where a gcc is found in PATH. +# If no gcc found in PATH with listed prefixes return nothing +cc-cross-prefix = $(firstword $(foreach c, $(filter-out -%, $(1)), \ + $(if $(shell which $(c)gcc), $(c)))) # output directory for tests below TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)