summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Bettis <jbettis@google.com>2022-09-16 11:33:08 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-09-19 17:52:21 +0000
commit9935980b106f49cf524b07e83c6333cde3294cd3 (patch)
tree7ffc7a7190e46882e347319fb7f0a2a23ffbdec0
parent43f60bb703cd54a5e03837a98d511e3c86406aff (diff)
downloadchrome-ec-9935980b106f49cf524b07e83c6333cde3294cd3.tar.gz
Makefile: Only set host toolchain if exists
To fix building outside of the chroot, only set the CROSS_COMPILE_HOST_DEFAULT to x86_64-pc-linux-gnu- if the compiler actually exists. BRANCH=None BUG=b:246424843 TEST=make test-coverage # in chroot TEST=make test-coverage # in gitlab docker TEST=emerge-corsola chromeos-ec Force-Relevant-Builds: all Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Icc134eb987033012188a7c77860d8115c41b4df4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3902029 Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Code-Coverage: Aaron Massey <aaronmassey@google.com>
-rw-r--r--core/host/toolchain.mk4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/host/toolchain.mk b/core/host/toolchain.mk
index 168d0e24c2..c0e4d90d43 100644
--- a/core/host/toolchain.mk
+++ b/core/host/toolchain.mk
@@ -2,7 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-CROSS_COMPILE_HOST_DEFAULT:=x86_64-pc-linux-gnu-
+CROSS_COMPILE_HOST_DEFAULT:=$(if \
+ $(shell which x86_64-pc-linux-gnu-$(cc-name) 2>/dev/null), \
+ x86_64-pc-linux-gnu-,)
$(call set-option,CROSS_COMPILE,\
$(CROSS_COMPILE_host),\