Commit f4ed108a authored by Anas Nashif's avatar Anas Nashif Committed by Andrew Boie
Browse files

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: default avatarAnas Nashif <anas.nashif@intel.com>
Signed-off-by: default avatarKumar Gala <kumar.gala@linaro.org>
parent 259c2439
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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    $@