diff --git a/Makefile.include b/Makefile.include index 3a63080c23..f29184448e 100644 --- a/Makefile.include +++ b/Makefile.include @@ -173,6 +173,27 @@ include $(RIOTMAKE)/boards.inc.mk # Debug targets for build system migration include $(RIOTMAKE)/dependencies_debug.inc.mk +# Use TOOLCHAIN environment variable to select the toolchain to use. +# If native, TOOLCHAIN for OSX is llvm +ifeq ($(BOARD),native) + ifeq ($(OS),Darwin) + TOOLCHAIN ?= llvm + endif +endif +# Use override so that we can redefine a variable set on the command line (as +# opposed to one set in the environment) +ifeq (clang,$(TOOLCHAIN)) + # TOOLCHAIN = clang is an alias for TOOLCHAIN = llvm + override TOOLCHAIN := llvm +endif +ifeq (gcc,$(TOOLCHAIN)) + # TOOLCHAIN = gcc is an alias for TOOLCHAIN = gnu + override TOOLCHAIN := gnu +endif +ifeq (,$(TOOLCHAIN)) + override TOOLCHAIN := gnu +endif + GLOBAL_GOALS += buildtest \ buildtest-indocker \ info-boards-features-blacklisted \ @@ -320,33 +341,6 @@ ifeq (, $(APPLICATION)) $(error An application name must be specified as APPLICATION.) endif -# Use TOOLCHAIN environment variable to select the toolchain to use. -# Default for macOS: llvm; for other OS: gnu -ifeq ($(BOARD),native) -ifeq ($(OS),Darwin) -TOOLCHAIN ?= llvm -endif -endif -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 - - # default toolchain prefix, defaults to target triple followed by a dash, you # will most likely not need to touch this. export PREFIX ?= $(if $(TARGET_ARCH),$(TARGET_ARCH)-)