Makefile.toolchain.zephyr: Test CONFIG_TOOLCHAIN_VARIANT robustly.
Current code tests treats "" (quotes included) as an empty value for that varible (as coming from Kconfig). However, that file also used to integrate with build systems for 3rd-party components, e.g. as examplified by samples/static_lib, and in that case it will be just an empty string. So, first strip surrounding quotes, then test for empty string. samples/static_lib: Update for recent Makefile.toolchain.zephyr changes. Makefile.toolchain.zephyr is 2-pass now, so needs to be included twice. ARCH needs to be defined *before* including it. Otherwise, just used CROSS_COMPILE and TOOLCHAIN_CFLAGS set by it. Change-Id: I56e963d0d107c77390395682d60400cf6ca62337 Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This commit is contained in:
parent
3cbd600dc5
commit
38e3e0b812
2 changed files with 9 additions and 7 deletions
|
@ -14,14 +14,15 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
include $(ZEPHYR_BASE)/scripts/Makefile.toolchain.$(ZEPHYR_GCC_VARIANT)
|
||||
|
||||
# This Makefile is like a replacement of the $(ZEPHYR_BASE)/Makefile
|
||||
# for libraries. So, we need to define ARCH here.
|
||||
# for libraries. So, we need to define ARCH, and do it before including
|
||||
# Makefile.toolchain.*
|
||||
ARCH ?= x86
|
||||
|
||||
CROSS_COMPILE = $(CROSS_COMPILE_$(ARCH))
|
||||
TOOLCHAIN_CFLAGS = $(TOOLCHAIN_CFLAGS_$(ARCH))
|
||||
# This include will set CROSS_COMPILE & TOOLCHAIN_CFLAGS for us. It uses
|
||||
# two-pass compile flag configuration, so needs to be included twice.
|
||||
include $(ZEPHYR_BASE)/scripts/Makefile.toolchain.$(ZEPHYR_GCC_VARIANT)
|
||||
include $(ZEPHYR_BASE)/scripts/Makefile.toolchain.$(ZEPHYR_GCC_VARIANT)
|
||||
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
AR = $(CROSS_COMPILE)ar
|
||||
|
|
|
@ -51,7 +51,8 @@ CROSS_COMPILE_nios2=$(TOOLCHAIN_HOME)/usr/bin/$(CROSS_COMPILE_TARGET_nios2)/$(CR
|
|||
|
||||
else
|
||||
|
||||
ifneq ($(CONFIG_TOOLCHAIN_VARIANT),"")
|
||||
# Test CONFIG_TOOLCHAIN_VARIANT value with surrounding quotes removed (if any)
|
||||
ifneq ($(CONFIG_TOOLCHAIN_VARIANT:"%"=%),)
|
||||
SYSROOT := ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${SYSROOT_TARGET_$(subst $\",,${CONFIG_TOOLCHAIN_VARIANT})}
|
||||
else
|
||||
SYSROOT := ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${SYSROOT_TARGET_${ARCH}}
|
||||
|
@ -63,7 +64,7 @@ TOOLCHAIN_CFLAGS = -I $(SYSROOT)/usr/include
|
|||
LIB_INCLUDE_DIR = -L $(LIBGCC_DIR) -L $(SYSROOT)/usr/lib/$(NEWLIB_DIR)
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_TOOLCHAIN_VARIANT),"")
|
||||
ifneq ($(CONFIG_TOOLCHAIN_VARIANT:"%"=%),)
|
||||
CROSS_COMPILE = $(CROSS_COMPILE_$(subst $\",,$(CONFIG_TOOLCHAIN_VARIANT)))
|
||||
else
|
||||
CROSS_COMPILE = $(CROSS_COMPILE_$(ARCH))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue