summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2022-09-13 13:41:47 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-09-16 15:51:20 +0000
commitf9e3ebc75dfcae47bdc7a6e28affb34d00166783 (patch)
tree710e7cbe10926dae4ff35f1135ad6e5194aced7e
parent92adcc327f606e3e2eb55b4b5869121f1f34f038 (diff)
downloadchrome-ec-f9e3ebc75dfcae47bdc7a6e28affb34d00166783.tar.gz
Makefile: Set prefixed toolchain for host
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: I50d2b437374bf6857b19151edb5eaea24a7330c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3894407 Reviewed-by: Eric Yilun Lin <yllin@google.com>
-rw-r--r--Makefile2
-rw-r--r--Makefile.rules2
-rw-r--r--core/host/toolchain.mk9
3 files changed, 10 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index cd2af16ea5..5dc693c793 100644
--- a/Makefile
+++ b/Makefile
@@ -119,9 +119,7 @@ include chip/$(CHIP)/build.mk
# (CC, CPP, CXX, etc.) so that the correct toolchain is used. The CORE variable
# is set in the CHIP build file, so this include must come after including the
# CHIP build file.
-ifneq ($(BOARD), host)
include core/$(CORE)/toolchain.mk
-endif
# Create uppercase config variants, to avoid mixed case constants.
# Also translate '-' to '_', so 'cortex-m' turns into 'CORTEX_M'. This must
diff --git a/Makefile.rules b/Makefile.rules
index 05a0ae4e45..12418e5be1 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -116,7 +116,7 @@ cmd_cxx_to_host = $(HOSTCXX) -std=gnu++17 $(HOST_CXXFLAGS) \
$(sort $(foreach c,$($(*F)-objs),util/$(c:%.o=%.cc)) $(wildcard $*.cc)) $(HOST_LDFLAGS)
cmd_o_to_a = $(AR) rcs $@ $^
cmd_host_test = $(MAKE) BOARD=host PROJECT=$* \
- V=$(V) out=build/host/$* TEST_BUILD=y EMU_BUILD=y CROSS_COMPILE= \
+ V=$(V) out=build/host/$* TEST_BUILD=y EMU_BUILD=y \
$(if $(TEST_SCRIPT),TEST_SCRIPT=$(TEST_SCRIPT)) $(TEST_FLAG) \
build/host/$*/$*.exe
cmd_coverage_test = $(subst build/host,build/coverage,$(cmd_host_test))
diff --git a/core/host/toolchain.mk b/core/host/toolchain.mk
new file mode 100644
index 0000000000..168d0e24c2
--- /dev/null
+++ b/core/host/toolchain.mk
@@ -0,0 +1,9 @@
+# Copyright 2022 The ChromiumOS Authors
+# 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-
+
+$(call set-option,CROSS_COMPILE,\
+ $(CROSS_COMPILE_host),\
+ $(CROSS_COMPILE_HOST_DEFAULT))