summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--makefiles/Makefile.tools15
1 files changed, 10 insertions, 5 deletions
diff --git a/makefiles/Makefile.tools b/makefiles/Makefile.tools
index febfe8c..86ab68b 100644
--- a/makefiles/Makefile.tools
+++ b/makefiles/Makefile.tools
@@ -55,17 +55,13 @@ HOST_CC ?= cc
# Host/build platform detection
###############################################################################
-# Autodetect build or CC
-CC__ := $(CC)
+# Autodetect build
ifeq ($(BUILD),)
BUILD := $(shell $(CC) -dumpmachine)
ifeq ($(BUILD),)
$(error "Failed to guess BUILD")
endif
else
- ifeq ($(origin CC),default)
- CC__ := $(BUILD)-gcc
- endif
endif
# Autodetect host if necessary
@@ -76,6 +72,9 @@ ifeq ($(HOST),)
endif
endif
+# Make first-stab at identity of CC
+CC__ := $(CC)
+
ifeq ($(HOST),$(BUILD))
# Native build
@@ -104,6 +103,12 @@ ifeq ($(HOST),$(BUILD))
else
# Cross compiling
+ # Improve our guess at the identity of CC
+ # (only if CC was not specified by the user)
+ ifeq ($(origin CC),default)
+ CC__ := $(BUILD)-gcc
+ endif
+
# Search the path for the compiler
toolpath_ := $(shell /bin/which $(CC__))
ifeq ($(toolpath_),)