summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDmitriy Korovkin <dmitriy.korovkin@windriver.com>2016-10-03 14:58:18 -0400
committerAnas Nashif <nashif@linux.intel.com>2016-10-05 10:29:31 +0000
commit19f2884738a92583b28d9edf514e0c18438b65d1 (patch)
treef00669b8a2cab9d9e4623b814bc6b2488a8441e5 /Makefile
parentd846dd1fcd8ee531080cb1c0ef5b86d4d812c98e (diff)
unified: Fix build broblem caused by concurrent make processes in single dir
Make sure that kernel/unified, that is included in libs-y does not built recursively through building kernel/ directory. Make sure that any lib.a library is not included into libzephyr.a and thus object modules from those lib.a files are linked only if a function from that object module is referenced from the application. Jira: ZEP-1025 Change-Id: Id3a3e96ca0b8abc9aedde0ffb9baa0164e380464 Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile14
1 files changed, 8 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 8fe7e35c9..cfab9c738 100644
--- a/Makefile
+++ b/Makefile
@@ -534,8 +534,6 @@ scripts: scripts_basic include/config/auto.conf include/config/tristate.conf
# arch/ must be last here so that .gnu.linkonce magic for interrupts/exceptions
# works as expected
-core-y := lib/ kernel/ misc/ net/ boards/ ext/ usb/ fs/ tests/ arch/
-drivers-y := drivers/
ifneq ($(strip $(MAKEFILE_APP_DIR)),)
MAKEFILE_APP := $(realpath $(MAKEFILE_APP_DIR)/Makefile.app)
@@ -580,7 +578,11 @@ endif # $(dot-config)
# Unified kernel objects are built as a static library
ifeq ($(CONFIG_KERNEL_V2),y)
libs-y := kernel/unified/
+core-y := lib/ misc/ net/ boards/ ext/ usb/ fs/ tests/ arch/
+else
+core-y := lib/ kernel/ misc/ net/ boards/ ext/ usb/ fs/ tests/ arch/
endif
+drivers-y := drivers/
ARCH = $(subst $(DQUOTE),,$(CONFIG_ARCH))
export ARCH
@@ -796,10 +798,10 @@ OUTPUT_FORMAT ?= elf32-i386
OUTPUT_ARCH ?= i386
quiet_cmd_ar_target = AR $@
-# Assume that if the directory listed in libs-y contains built-in.o,
-# it has been linked into the upper level built-in.o
+# Do not put lib.a into libzephyr.a. lib.a files are to be linked separately to
+# the final image
cmd_ar_target = rm -f $@; $(AR) rcT$(KBUILD_ARFLAGS) $@ \
- $(filter-out $(libs-y), $(KBUILD_ZEPHYR_MAIN))
+ $(filter-out %/lib.a, $(KBUILD_ZEPHYR_MAIN))
libzephyr.a: $(zephyr-deps)
$(call cmd,ar_target)
@@ -817,7 +819,7 @@ quiet_cmd_create-lnk = LINK $@
echo "$(app-y)"; \
echo "libzephyr.a"; \
echo "$(LINKFLAGPREFIX)--no-whole-archive"; \
- echo "$(filter %/lib.a, $(libs-y))"; \
+ echo "$(filter %/lib.a, $(KBUILD_ZEPHYR_MAIN))"; \
echo "$(objtree)/arch/$(ARCH)/core/offsets/offsets.o"; \
echo "$(LINKFLAGPREFIX)--end-group"; \
echo "$(LIB_INCLUDE_DIR) $(LINK_LIBS)"; \