build: create libzephyr.a and link it in instead of objects
Enabling building of the kernel archive as the first step towards split kernel and app builds. An application will be able to link against this archive in the final step of the build process. Change-Id: If0abc7002d19ca2ca10c7babd83fe1dc6fccebfa Signed-off-by: Anas Nashif <anas.nashif@intel.com> Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
259c24397d
commit
f4ed108ada
1 changed files with 6 additions and 2 deletions
8
Makefile
8
Makefile
|
@ -768,6 +768,10 @@ LINK_LIBS := $(foreach l,$(ALL_LIBS), -l$(l))
|
|||
OUTPUT_FORMAT ?= elf32-i386
|
||||
OUTPUT_ARCH ?= i386
|
||||
|
||||
libzephyr.a: $(zephyr-deps)
|
||||
@rm -f $@
|
||||
$(Q)$(AR) -rcT libzephyr.a $(KBUILD_ZEPHYR_MAIN)
|
||||
|
||||
quiet_cmd_create-lnk = LINK $@
|
||||
cmd_create-lnk = \
|
||||
( \
|
||||
|
@ -780,8 +784,8 @@ quiet_cmd_create-lnk = LINK $@
|
|||
echo "$(LINKFLAGPREFIX)--whole-archive"; \
|
||||
echo "$(KBUILD_ZEPHYR_APP)"; \
|
||||
echo "$(app-y)"; \
|
||||
echo "libzephyr.a"; \
|
||||
echo "$(LINKFLAGPREFIX)--no-whole-archive"; \
|
||||
echo "$(KBUILD_ZEPHYR_MAIN)"; \
|
||||
echo "$(objtree)/arch/$(ARCH)/core/offsets/offsets.o"; \
|
||||
echo "$(LINKFLAGPREFIX)--end-group"; \
|
||||
echo "$(LIB_INCLUDE_DIR) $(LINK_LIBS)"; \
|
||||
|
@ -802,7 +806,7 @@ final-linker.cmd: $(zephyr-deps)
|
|||
|
||||
TMP_ELF = .tmp_$(KERNEL_NAME).prebuilt
|
||||
|
||||
$(TMP_ELF): $(zephyr-deps) $(KBUILD_ZEPHYR_APP) $(app-y) linker.cmd $(KERNEL_NAME).lnk
|
||||
$(TMP_ELF): $(zephyr-deps) libzephyr.a $(KBUILD_ZEPHYR_APP) $(app-y) linker.cmd $(KERNEL_NAME).lnk
|
||||
$(Q)$(CC) -T linker.cmd @$(KERNEL_NAME).lnk -o $@
|
||||
|
||||
quiet_cmd_gen_idt = SIDT $@
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue