1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #14336 from aabadie/pr/make/toolchain_vars_no_export

makefiles/toolchain: only export toolchain vars globally from vars.inc.mk
This commit is contained in:
Francisco 2020-06-24 12:33:09 +02:00 committed by GitHub
commit efa3b974d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 39 deletions

View File

@ -108,6 +108,7 @@ UNEXPORTED_VARIABLES+=('PYOCD_ADAPTER_INIT')
UNEXPORTED_VARIABLES+=('JLINK_DEVICE' 'JLINK_IF')
UNEXPORTED_VARIABLES+=('JLINK_PRE_FLASH' 'JLINK_RESET_FILE')
UNEXPORTED_VARIABLES+=('GIT_CACHE' 'GIT_CACHE_DIR')
UNEXPORTED_VARIABLES+=('LINKXX')
EXPORTED_VARIABLES_ONLY_IN_VARS=()
EXPORTED_VARIABLES_ONLY_IN_VARS+=('APPDEPS')
@ -121,6 +122,10 @@ EXPORTED_VARIABLES_ONLY_IN_VARS+=('TARGET_ARCH')
EXPORTED_VARIABLES_ONLY_IN_VARS+=('TOOLCHAIN')
EXPORTED_VARIABLES_ONLY_IN_VARS+=('WERROR')
EXPORTED_VARIABLES_ONLY_IN_VARS+=('WPEDANTIC')
EXPORTED_VARIABLES_ONLY_IN_VARS+=('CC[ =]' 'CXX' 'CCAS')
EXPORTED_VARIABLES_ONLY_IN_VARS+=('AR[ =]' 'RANLIB')
EXPORTED_VARIABLES_ONLY_IN_VARS+=('AS' 'NM' 'SIZE' 'LINK')
EXPORTED_VARIABLES_ONLY_IN_VARS+=('OBJDUMP' 'OBJCOPY')
check_not_exporting_variables() {
local patterns=()

View File

@ -1,6 +1,6 @@
include $(RIOTMAKE)/toolchain/gnu.inc.mk
export CC = $(PREFIX)afl-gcc
export CXX = $(PREFIX)afl-g++
export LINK = $(PREFIX)afl-gcc
export LINKXX = $(PREFIX)afl-g++
CC = $(PREFIX)afl-gcc
CXX = $(PREFIX)afl-g++
LINK = $(PREFIX)afl-gcc
LINKXX = $(PREFIX)afl-g++

View File

@ -1,26 +1,26 @@
export CC = $(PREFIX)gcc
export CXX = $(PREFIX)g++
export CCAS ?= $(CC)
CC = $(PREFIX)gcc
CXX = $(PREFIX)g++
CCAS ?= $(CC)
ifeq ($(LTO),1)
export AR = $(PREFIX)gcc-ar
export RANLIB = $(PREFIX)gcc-ranlib
AR = $(PREFIX)gcc-ar
RANLIB = $(PREFIX)gcc-ranlib
else
export AR = $(PREFIX)ar
export RANLIB = $(PREFIX)ranlib
AR = $(PREFIX)ar
RANLIB = $(PREFIX)ranlib
endif
export AS = $(PREFIX)as
export NM = $(PREFIX)nm
export LINK = $(PREFIX)gcc
export LINKXX = $(PREFIX)g++
export SIZE = $(PREFIX)size
AS = $(PREFIX)as
NM = $(PREFIX)nm
LINK = $(PREFIX)gcc
LINKXX = $(PREFIX)g++
SIZE = $(PREFIX)size
_OBJCOPY := $(shell command -v $(PREFIX)objcopy || command -v gobjcopy || command -v objcopy)
export OBJCOPY ?= $(_OBJCOPY)
OBJCOPY ?= $(_OBJCOPY)
ifeq ($(OBJCOPY),)
$(warning objcopy not found. Hex file will not be created.)
export OBJCOPY = true
$(warning objcopy not found. Hex file will not be created.)
OBJCOPY = true
endif
# Default to the native (g)objdump, helps when using toolchain from docker
_OBJDUMP := $(or $(shell command -v $(PREFIX)objdump || command -v gobjdump),objdump)
export OBJDUMP ?= $(_OBJDUMP)
OBJDUMP ?= $(_OBJDUMP)
# We use GDB for debugging
include $(RIOTMAKE)/tools/gdb.inc.mk

View File

@ -1,35 +1,35 @@
export LLVMPREFIX ?= llvm-
LLVMPREFIX ?= llvm-
# Apple XCode doesn't prefix its tools with llvm-, but manually installed LLVM
# on OSX might have the llvm- prefix, we can't simply test against uname -s.
# Test if llvm-ar exists
ifeq (,$(shell command -v $(LLVMPREFIX)ar 2>/dev/null))
# fall back to system tools
export LLVMPREFIX :=
# fall back to system tools
LLVMPREFIX :=
endif
export CC = clang
export CXX = clang++
export CCAS ?= $(CC)
export AS = $(LLVMPREFIX)as
export AR = $(LLVMPREFIX)ar
export NM = $(LLVMPREFIX)nm
CC = clang
CXX = clang++
CCAS ?= $(CC)
AS = $(LLVMPREFIX)as
AR = $(LLVMPREFIX)ar
NM = $(LLVMPREFIX)nm
# LLVM does have a linker, however, it is not entirely
# compatible with GCC. For instance spec files as used in
# `makefiles/libc/newlib.mk` are not supported. Therefore
# we just use GCC for now.
export LINK = $(PREFIX)gcc
export LINKXX = $(PREFIX)g++
LINK = $(PREFIX)gcc
LINKXX = $(PREFIX)g++
# objcopy does not have a clear substitute in LLVM, use GNU binutils
#export OBJCOPY = $(LLVMPREFIX)objcopy
_OBJCOPY := $(shell command -v $(PREFIX)objcopy || command -v gobjcopy || command -v objcopy)
export OBJCOPY ?= $(_OBJCOPY)
# OBJCOPY = $(LLVMPREFIX)objcopy
_OBJCOPY := $(shell command -v $(PREFIX)objcopy || command -v gobjcopy || command -v objcopy)
OBJCOPY ?= $(_OBJCOPY)
ifeq ($(OBJCOPY),)
$(warning objcopy not found. Hex file will not be created.)
export OBJCOPY = true
$(warning objcopy not found. Hex file will not be created.)
OBJCOPY = true
endif
# Default to the native (g)objdump, helps when using toolchain from docker
_OBJDUMP := $(or $(shell command -v $(LLVMPREFIX)objdump || command -v gobjdump),objdump)
export OBJDUMP ?= $(_OBJDUMP)
export SIZE = $(LLVMPREFIX)size
_OBJDUMP := $(or $(shell command -v $(LLVMPREFIX)objdump || command -v gobjdump),objdump)
OBJDUMP ?= $(_OBJDUMP)
SIZE = $(LLVMPREFIX)size
# LLVM lacks a binutils strip tool as well...
#export STRIP = $(LLVMPREFIX)strip
# We use GDB for debugging for now, maybe LLDB will be supported in the future.

View File

@ -68,6 +68,8 @@ export ARFLAGS # Command-line options to pass to AR, default `rcs`
export AS # The assembler.
export ASFLAGS # Flags for the assembler.
export LINK # The command used to link the files. Must take the same parameters as GCC, i.e. "ld" won't work.
export NM # The command used to list symbols from objet files
export RANLIB # The command used to generate an index to the contents of an archive
# LINKFLAGS # Flags to supply in the linking step.
export LTOFLAGS # extra CFLAGS for compiling with link time optimization
export OBJCOPY # The command used to create the HEXFILE and BINFILE.