From a82556d8185e33b9fce2a52e4494da25a9ae2e2d Mon Sep 17 00:00:00 2001
From: Oleg Hahm <oleg@hobbykeller.org>
Date: Tue, 15 Mar 2016 11:55:40 +0100
Subject: [PATCH] make: always include toolchain dependent Makefile

---
 Makefile.include                    | 26 ++++++++++++++++++++++++++
 cpu/Makefile.include.cortexm_common | 26 --------------------------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/Makefile.include b/Makefile.include
index c1439114a5..4decf6ed66 100644
--- a/Makefile.include
+++ b/Makefile.include
@@ -136,6 +136,32 @@ ifneq (0,$(shell test -d $(RIOTBOARD)/$(BOARD); echo $$?))
     $(error The specified board $(BOARD) does not exist.)
 endif
 
+# Use TOOLCHAIN environment variable to select the toolchain to use.
+# Default: gnu
+TOOLCHAIN ?= gnu
+
+# TOOLCHAIN = clang is an alias for TOOLCHAIN = llvm
+ifeq (clang,$(TOOLCHAIN))
+# use override so that we can redefine a variable set on the command line (as
+# opposed to one set in the environment)
+override TOOLCHAIN := llvm
+endif
+# TOOLCHAIN = gcc is an alias for TOOLCHAIN = gnu
+ifeq (gcc,$(TOOLCHAIN))
+# use override so that we can redefine a variable set on the command line (as
+# opposed to one set in the environment)
+override TOOLCHAIN := gnu
+endif
+
+ifeq (,$(TOOLCHAIN))
+override TOOLCHAIN := gnu
+endif
+
+export TOOLCHAIN
+
+# Import all toolchain settings
+include $(RIOTCPU)/Makefile.include.$(TOOLCHAIN)
+
 # mandatory includes!
 include $(RIOTBASE)/Makefile.modules
 include $(RIOTBOARD)/$(BOARD)/Makefile.include
diff --git a/cpu/Makefile.include.cortexm_common b/cpu/Makefile.include.cortexm_common
index 726d82c0b3..2c3f941c50 100644
--- a/cpu/Makefile.include.cortexm_common
+++ b/cpu/Makefile.include.cortexm_common
@@ -1,29 +1,6 @@
 # Target triple for the build. Use arm-none-eabi if you are unsure.
 export TARGET_TRIPLE ?= arm-none-eabi
 
-# Use TOOLCHAIN environment variable to select the toolchain to use.
-# Default: gnu
-TOOLCHAIN ?= gnu
-
-# TOOLCHAIN = clang is an alias for TOOLCHAIN = llvm
-ifeq (clang,$(TOOLCHAIN))
-# use override so that we can redefine a variable set on the command line (as
-# opposed to one set in the environment)
-override TOOLCHAIN := llvm
-endif
-# TOOLCHAIN = gcc is an alias for TOOLCHAIN = gnu
-ifeq (gcc,$(TOOLCHAIN))
-# use override so that we can redefine a variable set on the command line (as
-# opposed to one set in the environment)
-override TOOLCHAIN := gnu
-endif
-
-ifeq (,$(TOOLCHAIN))
-override TOOLCHAIN := gnu
-endif
-
-export TOOLCHAIN
-
 # default toolchain prefix, defaults to target triple followed by a dash, you
 # will most likely not need to touch this.
 export PREFIX ?= $(if $(TARGET_TRIPLE),$(TARGET_TRIPLE)-)
@@ -116,9 +93,6 @@ endif
 # CPU depends on the cortex-m common module, so include it:
 include $(RIOTCPU)/cortexm_common/Makefile.include
 
-# Import all toolchain settings
-include $(RIOTCPU)/Makefile.include.$(TOOLCHAIN)
-
 # use the nano-specs of Newlib when available
 ifeq ($(shell $(LINK) -specs=nano.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
 export LINKFLAGS += -specs=nano.specs -lc -lnosys
-- 
GitLab