mk/lib: Build subdirs before lib dir

The subdirectories of libraries are currently listed as dependencies of
the library. If you look at the actual symbols they contain, the
opposite is true. For all of the bdevs, event subsystems and other
library directories, the subdirectories actually rely on symbols
contained in the parent directory.
If we want to create the proper inter-library dependencies in SPDK at
compile/link time, then we need to respect the order of these symbol
dependencies when executing make (e.g. make libspdk_event.so before
libspdk_event_bdev.so). Otherwise we create a loop of dependencies in
the make system.

Change-Id: Idcbb050b2709f575d0cec46b481824d6313612b4
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465191
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Seth Howell 2019-08-13 10:43:39 -07:00 committed by Jim Harris
parent 7964f1df90
commit 2a3b6b4179

View File

@ -50,11 +50,24 @@ else
LOCAL_SYS_LIBS += -lrt
endif
define subdirs_rule
$(1): $(2)
@+$(Q)$(MAKE) -C $(1) S=$S$(S:%=/)$@ $(MAKECMDGOALS)
endef
$(foreach dir,$(DIRS-y),$(eval $(call subdirs_rule,$(dir),$(DEP))))
ifneq ($(DIRS-y),)
BUILD_DEP := $(DIRS-y)
else
BUILD_DEP := $(DEP)
endif
SPDK_DEP_LIBS = $(call spdk_lib_list_to_shared_libs,$(SPDK_DEP_LIBNAMES))
.PHONY: all clean $(DIRS-y)
all: $(DEP) $(DIRS-y)
all: $(BUILD_DEP)
@:
clean: $(DIRS-y)
@ -76,12 +89,10 @@ ifeq ($(CONFIG_SHARED),y)
$(INSTALL_SHARED_LIB)
endif
uninstall:
uninstall: $(DIRS-y)
$(UNINSTALL_LIB)
ifeq ($(CONFIG_SHARED),y)
$(UNINSTALL_SHARED_LIB)
endif
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
include $(SPDK_ROOT_DIR)/mk/spdk.subdirs.mk