From: Panu Matilainen Date: Tue, 7 Jun 2016 10:01:54 +0000 (+0300) Subject: mk: generate internal library dependencies X-Git-Tag: spdx-start~6789 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=bf5a46fa597248909f6a4e41a9a8467dcc3df21a;p=dpdk.git mk: generate internal library dependencies Up to now dependencies between DPDK internal libraries have been untracked at shared library level, requiring applications to know about library internal dependencies and often consequently overlinking. Since the dependencies are already recorded for build ordering in the makefiles with DEPDIRS-y we can use that information to generate LDLIBS entries for internal libraries automatically. Also revert commit 8180554d82b3 ("vhost: fix linkage of driver with library") which is made redundant by this change. Signed-off-by: Panu Matilainen Acked-by: Christian Ehrhardt --- diff --git a/drivers/net/vhost/Makefile b/drivers/net/vhost/Makefile index 30b91a066e..f49a69b3bd 100644 --- a/drivers/net/vhost/Makefile +++ b/drivers/net/vhost/Makefile @@ -38,7 +38,6 @@ LIB = librte_pmd_vhost.a CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) -LDLIBS += -lrte_vhost EXPORT_MAP := rte_pmd_vhost_version.map diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk index b420280d9e..1ff403f5ef 100644 --- a/mk/rte.lib.mk +++ b/mk/rte.lib.mk @@ -77,6 +77,13 @@ else _CPU_LDFLAGS := $(CPU_LDFLAGS) endif +# Translate DEPDIRS-y into LDLIBS +# Ignore (sub)directory dependencies which do not provide an actual library +_IGNORE_DIRS = lib/librte_eal/% lib/librte_net lib/librte_compat +_DEPDIRS = $(filter-out $(_IGNORE_DIRS),$(DEPDIRS-y)) +_LDDIRS = $(subst librte_ether,libethdev,$(_DEPDIRS)) +LDLIBS += $(subst lib/lib,-l,$(_LDDIRS)) + O_TO_A = $(AR) crDs $(LIB) $(OBJS-y) O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)")