Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
########################################################################
|
|
|
|
#
|
|
|
|
# Pass1: Determine CROSS_COMPILE only.
|
|
|
|
# We need CROSS_COMPILE in order to validate various KBUILD_CFLAGS
|
|
|
|
# GCC CROSS_COMILE is needed in order to validate compiler options
|
|
|
|
# via constructs such as:
|
|
|
|
# KBUILD_CFLAGS += $(call cc-option,-option,)
|
|
|
|
#
|
|
|
|
# Pass2: Determine LIB_INCLUDE_DIR and TOOLCHAIN_CFLAGS.
|
|
|
|
# Knowing KBUILD_CFLAGS, we can query GCC compiler for the location
|
|
|
|
# of the libraries corresponding to the KBUILD_CFLAGS.
|
|
|
|
#
|
|
|
|
#######################################################################
|
2015-10-05 22:34:50 +08:00
|
|
|
|
2016-09-14 00:35:58 +08:00
|
|
|
REQUIRED_SDK_VER=0.8.2
|
|
|
|
|
2015-10-05 22:34:50 +08:00
|
|
|
ifndef ZEPHYR_SDK_INSTALL_DIR
|
2016-09-14 00:35:58 +08:00
|
|
|
|
2015-10-05 22:34:50 +08:00
|
|
|
$(error ZEPHYR_SDK_INSTALL_DIR is not set)
|
2016-09-14 00:35:58 +08:00
|
|
|
else
|
|
|
|
SDK_VERSION = $(shell cat ${ZEPHYR_SDK_INSTALL_DIR}/sdk_version)
|
2016-09-16 14:59:15 +08:00
|
|
|
SDK_CHECK = $(shell ${ZEPHYR_BASE}/scripts/vercomp $(REQUIRED_SDK_VER) $(SDK_VERSION) || echo $$?)
|
2016-09-14 00:35:58 +08:00
|
|
|
|
|
|
|
ifeq ($(SDK_CHECK),1)
|
|
|
|
$(error (The SDK version you are using is old, please update your SDK. You need at least SDK version $(REQUIRED_SDK_VER)))
|
|
|
|
endif
|
2015-10-05 22:34:50 +08:00
|
|
|
endif
|
|
|
|
|
2015-12-16 06:30:35 +08:00
|
|
|
ifeq ($(HOST_OS),MINGW)
|
|
|
|
TOOLCHAIN_HOME = ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-mingw32
|
|
|
|
else
|
|
|
|
TOOLCHAIN_HOME = ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-linux
|
|
|
|
endif
|
|
|
|
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
ifndef MAKEFILE_TOOLCHAIN_DO_PASS2
|
|
|
|
|
|
|
|
# arm (pass1)
|
2015-10-05 22:34:50 +08:00
|
|
|
CROSS_COMPILE_TARGET_arm = arm-poky-eabi
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
SYSROOT_TARGET_arm = armv5-poky-eabi
|
2015-12-16 06:30:35 +08:00
|
|
|
CROSS_COMPILE_arm=$(TOOLCHAIN_HOME)/usr/bin/$(CROSS_COMPILE_TARGET_arm)/$(CROSS_COMPILE_TARGET_arm)-
|
2016-02-11 05:18:36 +08:00
|
|
|
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
# arc (pass1)
|
|
|
|
CROSS_COMPILE_TARGET_arc = arc-poky-elf
|
|
|
|
SYSROOT_TARGET_arc = arc-poky-elf
|
|
|
|
CROSS_COMPILE_arc=$(TOOLCHAIN_HOME)/usr/bin/$(CROSS_COMPILE_TARGET_arc)/$(CROSS_COMPILE_TARGET_arc)-
|
2015-10-05 22:34:50 +08:00
|
|
|
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
# iamcu (pass1)
|
2015-10-05 22:34:50 +08:00
|
|
|
CROSS_COMPILE_TARGET_iamcu = i586-poky-elfiamcu
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
SYSROOT_TARGET_iamcu = iamcu-poky-elfiamcu
|
2015-12-16 06:30:35 +08:00
|
|
|
CROSS_COMPILE_iamcu=$(TOOLCHAIN_HOME)/usr/bin/iamcu-poky-elfiamcu/$(CROSS_COMPILE_TARGET_iamcu)-
|
2015-10-05 22:34:50 +08:00
|
|
|
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
# x86 (pass1)
|
2015-10-05 22:34:50 +08:00
|
|
|
CROSS_COMPILE_TARGET_x86 = i586-poky-elf
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
SYSROOT_TARGET_x86 = i586-poky-elf
|
2015-12-16 06:30:35 +08:00
|
|
|
CROSS_COMPILE_x86=$(TOOLCHAIN_HOME)/usr/bin/$(CROSS_COMPILE_TARGET_x86)/$(CROSS_COMPILE_TARGET_x86)-
|
2015-10-05 22:34:50 +08:00
|
|
|
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
# nios2 (pass1)
|
|
|
|
CROSS_COMPILE_TARGET_nios2 = nios2-poky-elf
|
|
|
|
SYSROOT_TARGET_nios2 = nios2-poky-elf
|
|
|
|
CROSS_COMPILE_nios2=$(TOOLCHAIN_HOME)/usr/bin/$(CROSS_COMPILE_TARGET_nios2)/$(CROSS_COMPILE_TARGET_nios2)-
|
2015-10-05 22:34:50 +08:00
|
|
|
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
else
|
2015-10-05 22:34:50 +08:00
|
|
|
|
2016-08-01 23:02:12 +08:00
|
|
|
# Test CONFIG_TOOLCHAIN_VARIANT value with surrounding quotes removed (if any)
|
|
|
|
ifneq ($(CONFIG_TOOLCHAIN_VARIANT:"%"=%),)
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
SYSROOT := ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${SYSROOT_TARGET_$(subst $\",,${CONFIG_TOOLCHAIN_VARIANT})}
|
|
|
|
else
|
|
|
|
SYSROOT := ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${SYSROOT_TARGET_${ARCH}}
|
|
|
|
endif
|
2016-04-22 01:10:47 +08:00
|
|
|
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
LIBGCC_DIR = $(shell dirname `$(CROSS_COMPILE)gcc --sysroot=$(SYSROOT) $(KBUILD_CFLAGS) -print-libgcc-file-name`)
|
|
|
|
NEWLIB_DIR = $(shell $(CROSS_COMPILE)gcc --sysroot=$(SYSROOT) $(KBUILD_CFLAGS) -print-multi-directory)
|
|
|
|
TOOLCHAIN_CFLAGS = -I $(SYSROOT)/usr/include
|
2016-11-02 01:11:06 +08:00
|
|
|
LIB_INCLUDE_DIR += -L $(LIBGCC_DIR) -L $(SYSROOT)/usr/lib/$(NEWLIB_DIR)
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
endif
|
2016-04-22 01:10:47 +08:00
|
|
|
|
2016-08-01 23:02:12 +08:00
|
|
|
ifneq ($(CONFIG_TOOLCHAIN_VARIANT:"%"=%),)
|
2015-10-05 22:34:50 +08:00
|
|
|
CROSS_COMPILE = $(CROSS_COMPILE_$(subst $\",,$(CONFIG_TOOLCHAIN_VARIANT)))
|
|
|
|
else
|
|
|
|
CROSS_COMPILE = $(CROSS_COMPILE_$(ARCH))
|
|
|
|
endif
|
|
|
|
|
2015-12-16 06:30:35 +08:00
|
|
|
QEMU_BIN_PATH ?= $(TOOLCHAIN_HOME)/usr/bin
|
|
|
|
QEMU_BIOS=$(TOOLCHAIN_HOME)/usr/share/qemu
|
2015-10-05 22:34:50 +08:00
|
|
|
|
|
|
|
TOOLCHAIN_LIBS = gcc
|
|
|
|
|
2016-04-09 10:14:56 +08:00
|
|
|
OPENOCD ?= ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-linux/usr/bin/openocd
|
|
|
|
OPENOCD_DEFAULT_PATH ?= ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/i686-pokysdk-linux/usr/share/openocd/scripts
|
2016-01-16 01:18:53 +08:00
|
|
|
|
|
|
|
export LIB_INCLUDE_DIR CROSS_COMPILE TOOLCHAIN_LIBS QEMU_BIN_PATH QEMU TOOLCHAIN_CFLAGS OPENOCD OPENOCD_DEFAULT_PATH
|
Makefile: Restructure for multilibs
Several Zephyr SDK toolchains support multilibs.
Instead of hard-coding locations of the libraries, the proper/cleanest way
is to query the GCC compiler for the locations of libgcc and libc.
However, in order to do this, we need to ensure a certain order of
initialization in the Makefile:
1. Determine CROSS_COMPILE.
We cannot determine LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS yet, as we don't
know the KBUILD_CFLAGS yet.
2. Calculate KBUILD_CFLAGS using CROSS_COMPILE
KBUILD_CFLAGS often need the compiler to validate options, i.e:
KBUILD_CFLAGS += $(call cc-option,-mabi=aapcs -mthumb -mcpu=cortex-m0)
However, LIB_INCLUDE_DIR, TOOLCHAIN_CFLAGS should not be needed for this
3. Finally, using CROSS_COMPILE and KBUILD_CFLAGS determine LIB_INCLUDE_DIR,
TOOLCHAIN_CFLAGS by querying GCC using -print-libgcc-file-name and
-print-multi-directory command line options.
This change should only affect Zephyr SDK toolchains, all other toolchains
are expected to function as before.
Change-Id: I27b460d46fe65d05fcb8bafb51cd6b3deba275ed
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-07-27 00:44:16 +08:00
|
|
|
|
|
|
|
ifndef MAKEFILE_TOOLCHAIN_DO_PASS2
|
|
|
|
MAKEFILE_TOOLCHAIN_DO_PASS2=true
|
|
|
|
endif
|