diff options
author | Tom Hughes <tomhughes@chromium.org> | 2022-09-13 11:32:38 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-17 03:24:37 +0000 |
commit | a8cc68e13bdc5bc4f52784357953c079ecd94d17 (patch) | |
tree | 23d1bc8837c72c0b5b9332945dd3e5ab7e6a1791 /Makefile.toolchain | |
parent | 20afff909ae6f437657295663d9274d7a004c7e5 (diff) | |
download | chrome-ec-a8cc68e13bdc5bc4f52784357953c079ecd94d17.tar.gz |
Makefile.toolchain: Need to specify full path to compiler for ebuild
When building with portage, the build fails if we use the "unprefixed"
compiler (e.g., "g++"). Explicitly use the prefixed compiler when
building for the host.
BRANCH=none
BUG=b:246424843
TEST=emerge-hatch chromeos-ec
Force-Relevant-Builds: all
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: Idd40d76fd0d1d32e55947898f98b6ef1f0ca628a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3901254
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'Makefile.toolchain')
-rw-r--r-- | Makefile.toolchain | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Makefile.toolchain b/Makefile.toolchain index 647bef90ed..90381797fd 100644 --- a/Makefile.toolchain +++ b/Makefile.toolchain @@ -29,8 +29,19 @@ endif # library. USE_BUILTIN_STDLIB:=1 +# Set the prefix for the compiler if specified (e.g., "x86_64-pc-linux-gnu-"). +ifeq ($(origin BUILDCC_PREFIX),undefined) +# If building with Portage use the environment variable it provides. +# https://wiki.gentoo.org/wiki/Embedded_Handbook/General/Introduction#Environment_variables +ifneq ($(CBUILD),) +BUILDCC_PREFIX:=$(CBUILD)- +else +BUILDCC_PREFIX:=x86_64-pc-linux-gnu- +endif +endif + # Extract cc-name -cc-name:=$(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc) +cc-name:=$(shell $(BUILDCC_PREFIX)$(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc) # Assume we want to use same compiler for both C and C++ ifeq ($(cc-name),gcc) @@ -55,7 +66,7 @@ OBJCOPY=$(CROSS_COMPILE)objcopy OBJDUMP=$(CROSS_COMPILE)objdump ADDR2LINE=$(CROSS_COMPILE)addr2line PKG_CONFIG?=pkg-config -BUILDCC?=$(CCACHE) $(cc-name) +BUILDCC?=$(CCACHE) $(BUILDCC_PREFIX)$(cc-name) HOSTCC?=$(CCACHE) $(HOST_CROSS_COMPILE)$(cc-name) HOSTCXX?=$(CCACHE) $(HOST_CROSS_COMPILE)clang++ HOST_PKG_CONFIG?=$(HOST_CROSS_COMPILE)pkg-config |