Commit 2a3b6b41 authored by Seth Howell's avatar Seth Howell Committed by Jim Harris
Browse files

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: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465191


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 7964f1df
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -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