zephyr: Automatically derive ARCH.

Currently to compile for anything that except ARCH=x86 we have to
provide ARCH via the environment or make arguments. We can do better
than that!

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
This commit is contained in:
Daniel Thompson 2016-09-19 17:47:46 +01:00 committed by Paul Sokolovsky
parent 7df9f313c6
commit 2ea52cb045

View File

@ -9,13 +9,18 @@
# Zephyr build system.
#
ARCH ?= x86
BOARD ?= qemu_x86
# Zephyr 1.5.0
#OUTDIR_PREFIX =
# Zephyr 1.6.0
OUTDIR_PREFIX = $(BOARD)
Z_DOTCONFIG = outdir/$(OUTDIR_PREFIX)/.config
DQUOTE = "
# "
include $(Z_DOTCONFIG)
override ARCH = $(subst $(DQUOTE),,$(CONFIG_ARCH))
# Zephyr toolchain config is 2-pass, so included twice
include $(ZEPHYR_BASE)/scripts/Makefile.toolchain.$(ZEPHYR_GCC_VARIANT)
include $(ZEPHYR_BASE)/scripts/Makefile.toolchain.$(ZEPHYR_GCC_VARIANT)
@ -50,6 +55,9 @@ CFLAGS = -std=gnu99 $(TOOLCHAIN_CFLAGS) $(INC) $(CFLAGS_MOD) $(COPT) $(CFLAGS_TA
include ../py/mkrules.mk
$(Z_DOTCONFIG):
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) initconfig
all: $(LIBMICROPYTHON)
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD)