Kbuild: Create directories for lib-y files during a O option.

This commit allows the following:

lib-y will create external directories, when building with
the O=<external/directory>option.

Originally in Kbuild, only obj-y dependencies were subject to
directory creation when builded in an external directory.

This change allow Kbuild to completely build in external
directories, including libc.a.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: If6c2bc77b2c00ce199df87a08f86e366f929ac08
This commit is contained in:
Juan Manuel Cruz 2015-03-04 17:34:47 -06:00 committed by Anas Nashif
parent de1cec29d6
commit 62cf77c569
2 changed files with 6 additions and 0 deletions

View file

@ -71,6 +71,10 @@ _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
# Create directories for object files if directory does not exist
# Needed when obj-y := dir/file.o syntax is used
_dummy := $(foreach d,$(obj-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
# Create directories for object files if directory does not exist
# Needed when lib-y := dir/file.o syntax is used
_dummy := $(foreach d,$(lib-dirs), $(shell [ -d $(d) ] || mkdir -p $(d)))
endif
ifndef obj

View file

@ -64,6 +64,7 @@ subdir-obj-y := $(filter %/built-in.o, $(obj-y))
# $(obj-dirs) is a list of directories that contain object files
obj-dirs := $(dir $(multi-objs) $(obj-y))
lib-dirs := $(dir $(lib-y))
# Replace multi-part objects by their individual parts, look at local dir only
real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)
@ -88,6 +89,7 @@ multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y))
multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m))
subdir-ym := $(addprefix $(obj)/,$(subdir-ym))
obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
lib-dirs := $(addprefix $(obj)/,$(lib-dirs))
# These flags are needed for modversions and compiling, so we define them here
# already