summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2016-04-05 10:28:54 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-04-05 22:00:44 -0700
commit7abeeeaad2b101265a79e0304be9393755b056ae (patch)
tree2381dcd786f77a8d5f91c5909956c098af48832e
parenta536bdb1cdec91963a813e5241b8c2bce16eb130 (diff)
downloadchrome-ec-7abeeeaad2b101265a79e0304be9393755b056ae.tar.gz
cleanup: Makefiles should check path assumptions
When compiling the EC firmware outside of the chroot, some optional packages may not be installed. Let's be sure the tools exist before we try to use them. BUG=none BRANCH=none TEST=make buildall, both inside and outside of the chroot Note that to build outside the chroot, we need to 1. Use GNU make verion 4.1 or later 2. Install the gcc-arm-none-eabi package Change-Id: I78c75cb4ad658c003ded71b244b0458ae5532e0b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/337341 Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r--Makefile.toolchain17
1 files changed, 11 insertions, 6 deletions
diff --git a/Makefile.toolchain b/Makefile.toolchain
index c4531ded3f..5956c7ad26 100644
--- a/Makefile.toolchain
+++ b/Makefile.toolchain
@@ -7,18 +7,23 @@
#
# Toolchain configuration
-HOST_CROSS_COMPILE ?= x86_64-pc-linux-gnu-
-CC=ccache $(CROSS_COMPILE)gcc
-CPP=ccache $(CROSS_COMPILE)cpp
+# Try not to assume too much about optional tools and prefixes
+CCACHE:=$(shell which ccache 2>/dev/null)
+ifeq ($(origin HOST_CROSS_COMPILE),undefined)
+HOST_CROSS_COMPILE:=$(if $(shell which x86_64-pc-linux-gnu-gcc 2>/dev/null),x86_64-pc-linux-gnu-,)
+endif
+
+CC=$(CCACHE) $(CROSS_COMPILE)gcc
+CPP=$(CCACHE) $(CROSS_COMPILE)cpp
LD=$(CROSS_COMPILE)ld
NM=$(CROSS_COMPILE)nm
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
PKG_CONFIG?=pkg-config
-BUILDCC?=ccache gcc
-HOSTCC?=ccache $(HOST_CROSS_COMPILE)gcc
-HOSTCXX?=ccache $(HOST_CROSS_COMPILE)g++
+BUILDCC?=$(CCACHE) gcc
+HOSTCC?=$(CCACHE) $(HOST_CROSS_COMPILE)gcc
+HOSTCXX?=$(CCACHE) $(HOST_CROSS_COMPILE)g++
C_WARN = -Wstrict-prototypes -Wdeclaration-after-statement -Wno-pointer-sign
COMMON_WARN = -Wall -Werror -Wundef -Wno-trigraphs -fno-strict-aliasing \