summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-06-26 21:52:53 +0200
committerRichard Braun <rbraun@sceen.net>2018-06-26 21:54:16 +0200
commita18a9d0cc0232dc151cef3d2d61807182ef7f6ea (patch)
tree5e822f9665fac3f81b8bd560a8183f9eae00687e
parent30dd97fb786ef5f7ca28049684b17bdc2ee7a718 (diff)
xbuild: minor changes
Improve the naming of compiler-related variables as well as their description.
-rw-r--r--Kconfig7
-rw-r--r--Makefile18
2 files changed, 17 insertions, 8 deletions
diff --git a/Kconfig b/Kconfig
index cf42e9f2..911fd274 100644
--- a/Kconfig
+++ b/Kconfig
@@ -26,13 +26,16 @@ config CFLAGS
menu "Build options"
-config CC_EXE
+config COMPILER
string "Compiler executable"
default CC
---help---
Name of the compiler executable
-config CC_OPTIONS
+ This includes any toolchain prefix, and must be a file name,
+ not a path.
+
+config COMPILER_OPTIONS
string "Compilation options"
default CFLAGS
---help---
diff --git a/Makefile b/Makefile
index 2ea03300..05e8228a 100644
--- a/Makefile
+++ b/Makefile
@@ -208,17 +208,23 @@ include/generated/autoconf.h: .config $(ALL_MAKEFILES)
-include .config
-ifdef CONFIG_CC_EXE
+ifdef CONFIG_COMPILER
# Use printf to remove quotes
-CC := $(shell printf -- $(CONFIG_CC_EXE))
+CC := $(shell printf -- $(CONFIG_COMPILER))
else
CC := gcc
endif
-# Export to CONFIG_CC
+# The CC variable is used by Kconfig to set the value of CONFIG_COMPILER.
export CC
-CPP = $(CC) -E
+TOOLCHAIN_NAME = $(shell printf "%s" $(CC) | rev | cut -s -d - -f 2- | rev)
+
+ifneq ($(TOOLCHAIN_NAME),)
+TOOLCHAIN_PREFIX = $(TOOLCHAIN_NAME)-
+endif
+
+CPP := $(CC) -E
CFLAGS ?= -O2 -g
@@ -282,9 +288,9 @@ include $(MAKEFILE_INCLUDES)
# Must be defined by the architecture-specific Makefile.
export KCONFIG_DEFCONFIG
-ifdef CONFIG_CC_OPTIONS
+ifdef CONFIG_COMPILER_OPTIONS
# Use printf to remove quotes
-XBUILD_CFLAGS += $(shell printf -- $(CONFIG_CC_OPTIONS))
+XBUILD_CFLAGS += $(shell printf -- $(CONFIG_COMPILER_OPTIONS))
endif
COMPILE := $(CC) $(XBUILD_CPPFLAGS) $(XBUILD_CFLAGS)