build: add extra dependency for zephyr.lnk and rebuild with new boards

When building an application for a different BOARD, the .link file
was never updated causing issues with linking.
Also, make sure we restart the build process when the board has changed.
This guarantees that the file is recreated when the dependencies have
changed.

Jira: ZEP-239
Change-Id: Ided3a71c03fd8b2c6ab9c2bf8370104cd5071c08
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2016-05-14 21:56:35 -04:00 committed by Anas Nashif
commit a0cf03b1c7
2 changed files with 8 additions and 2 deletions

View file

@ -780,7 +780,7 @@ quiet_cmd_create-lnk = LINK $@
echo "$(LIB_INCLUDE_DIR) $(LINK_LIBS)"; \
) > $@
$(KERNEL_NAME).lnk:
$(KERNEL_NAME).lnk: $(zephyr-deps)
$(call cmd,create-lnk)
linker.cmd: $(zephyr-deps)

View file

@ -63,6 +63,8 @@ endif
zephyrmake = @+$(MAKE) -C $(ZEPHYR_BASE) O=$(1) CFLAGS=$(CFLAGS) \
PROJECT=$(PROJECT_BASE) SOURCE_DIR=$(SOURCE_DIR) $(2)
BOARDCONFIG = $(O)/.board_$(BOARD)
DOTCONFIG = $(O)/.config
all: $(DOTCONFIG)
@ -94,6 +96,10 @@ debugserver: FORCE
initconfig: $(DOTCONFIG)
$(BOARDCONFIG):
@rm -f $(O)/.board_*
@touch $@
menuconfig: initconfig
$(Q)$(call zephyrmake,$(O),$@)
@ -106,7 +112,7 @@ help:
KERNEL_CONFIG = $(ZEPHYR_BASE)/kernel/configs/$(KERNEL_TYPE).config
$(DOTCONFIG): $(KBUILD_DEFCONFIG_PATH) $(CONF_FILE)
$(DOTCONFIG): $(BOARDCONFIG) $(KBUILD_DEFCONFIG_PATH) $(CONF_FILE)
$(Q)$(CONFIG_SHELL) $(ZEPHYR_BASE)/scripts/kconfig/merge_config.sh \
-q -m -O $(O) $(KBUILD_DEFCONFIG_PATH) $(KERNEL_CONFIG) $(CONF_FILE)
$(Q)$(MAKE) $(S) -C $(ZEPHYR_BASE) O=$(O) PROJECT=$(PROJECT_BASE) oldnoconfig