diff options
author | Tom Hughes <tomhughes@chromium.org> | 2022-09-19 16:29:51 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-21 19:11:44 +0000 |
commit | e530e9dc1385994afa342b7d877de582c4fb5bb6 (patch) | |
tree | 1d107dd7f90b8259e58bb9e75d42ee1aa8159f0b /Makefile.toolchain | |
parent | 3608bfa9759933cedb420483c0a7674c887be3ec (diff) | |
download | chrome-ec-e530e9dc1385994afa342b7d877de582c4fb5bb6.tar.gz |
Makefile.toolchain: Use portage env variable for host builds
When building the host tools with portage, we're not always building for
x86_64 (boards such as strongbad are ARM), so we need to use the Portage
environment variable to set the compiler prefix (HOST_CROSS_COMPILE).
BRANCH=none
BUG=b:246424843
TEST=emerge-strongbad chromeos-fpmcu-release-dartmonkey
Cq-Depend: chromium:3908089
Force-Relevant-Builds: all
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I43cff8e01b3445cbce80c5d6fa45d7e7a36c4eda
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3905897
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'Makefile.toolchain')
-rw-r--r-- | Makefile.toolchain | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile.toolchain b/Makefile.toolchain index 90381797fd..e26bf2c8a2 100644 --- a/Makefile.toolchain +++ b/Makefile.toolchain @@ -53,8 +53,14 @@ endif # Try not to assume too much about optional tools and prefixes CCACHE:=$(shell which ccache 2>/dev/null) ifeq ($(origin HOST_CROSS_COMPILE),undefined) +# If building with Portage use the environment variable it provides. +# https://wiki.gentoo.org/wiki/Embedded_Handbook/General/Introduction#Environment_variables +ifneq ($(CHOST),) +HOST_CROSS_COMPILE:=$(CHOST)- +else HOST_CROSS_COMPILE:=$(if $(shell which x86_64-pc-linux-gnu-$(cc-name) 2>/dev/null),x86_64-pc-linux-gnu-,) endif +endif AR=$(CROSS_COMPILE)ar CC=$(CCACHE) $(CROSS_COMPILE)$(cc-name) |