[dpdk-dev] [PATCH 3/3] mk: do not generate LDLIBS from directory dependencies

Olivier Matz olivier.matz at 6wind.com
Thu Oct 12 18:04:21 CEST 2017


The list of libraries in LDLIBS was generated from the DEPDIRS-xyz
variable. This is valid when the subdirectory name match the library
name, but it's not always the case, especially for PMDs.

The patches removes this feature and explicitly adds the proper
libraries in LDLIBS.

Some DEPDIRS-xyz variables become useless, remove them.

Reported-by: Gage Eads <gage.eads at intel.com>
Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
---
 drivers/bus/Makefile              |  2 --
 drivers/bus/dpaa/Makefile         |  2 ++
 drivers/bus/fslmc/Makefile        |  2 ++
 drivers/crypto/Makefile           | 11 -----------
 drivers/crypto/aesni_gcm/Makefile |  2 ++
 drivers/crypto/aesni_mb/Makefile  |  2 ++
 drivers/crypto/armv8/Makefile     |  2 ++
 drivers/crypto/dpaa2_sec/Makefile |  2 ++
 drivers/crypto/kasumi/Makefile    |  2 ++
 drivers/crypto/null/Makefile      |  2 ++
 drivers/crypto/openssl/Makefile   |  2 ++
 drivers/crypto/qat/Makefile       |  2 ++
 drivers/crypto/scheduler/Makefile |  2 ++
 drivers/crypto/snow3g/Makefile    |  2 ++
 drivers/crypto/zuc/Makefile       |  2 ++
 drivers/event/Makefile            |  4 ----
 drivers/event/dpaa2/Makefile      |  1 +
 drivers/event/octeontx/Makefile   |  1 +
 drivers/event/skeleton/Makefile   |  1 +
 drivers/event/sw/Makefile         |  1 +
 drivers/mempool/Makefile          |  5 -----
 drivers/mempool/dpaa/Makefile     |  1 +
 drivers/mempool/dpaa2/Makefile    |  1 +
 drivers/mempool/octeontx/Makefile |  1 +
 drivers/mempool/ring/Makefile     |  1 +
 drivers/mempool/stack/Makefile    |  1 +
 drivers/net/Makefile              | 35 -----------------------------------
 drivers/net/af_packet/Makefile    |  2 ++
 drivers/net/ark/Makefile          |  2 ++
 drivers/net/avp/Makefile          |  2 ++
 drivers/net/bnx2x/Makefile        |  2 ++
 drivers/net/bnxt/Makefile         |  2 ++
 drivers/net/bonding/Makefile      |  2 ++
 drivers/net/cxgbe/Makefile        |  2 ++
 drivers/net/dpaa/Makefile         |  2 ++
 drivers/net/dpaa2/Makefile        |  2 ++
 drivers/net/e1000/Makefile        |  2 ++
 drivers/net/ena/Makefile          |  2 ++
 drivers/net/enic/Makefile         |  2 ++
 drivers/net/failsafe/Makefile     |  2 ++
 drivers/net/fm10k/Makefile        |  2 ++
 drivers/net/i40e/Makefile         |  2 ++
 drivers/net/ixgbe/Makefile        |  2 ++
 drivers/net/kni/Makefile          |  2 ++
 drivers/net/liquidio/Makefile     |  2 ++
 drivers/net/mlx4/Makefile         |  2 ++
 drivers/net/mlx5/Makefile         |  2 ++
 drivers/net/mrvl/Makefile         |  2 ++
 drivers/net/nfp/Makefile          |  2 ++
 drivers/net/null/Makefile         |  2 ++
 drivers/net/octeontx/Makefile     |  2 ++
 drivers/net/pcap/Makefile         |  2 ++
 drivers/net/qede/Makefile         |  2 ++
 drivers/net/ring/Makefile         |  2 ++
 drivers/net/sfc/Makefile          |  2 ++
 drivers/net/softnic/Makefile      |  2 ++
 drivers/net/szedata2/Makefile     |  2 ++
 drivers/net/tap/Makefile          |  2 ++
 drivers/net/thunderx/Makefile     |  2 ++
 drivers/net/vhost/Makefile        |  2 ++
 drivers/net/virtio/Makefile       |  2 ++
 drivers/net/vmxnet3/Makefile      |  2 ++
 examples/ethtool/Makefile         |  1 -
 examples/ethtool/lib/Makefile     |  1 +
 lib/Makefile                      |  5 +++--
 lib/librte_acl/Makefile           |  1 +
 lib/librte_bitratestats/Makefile  |  1 +
 lib/librte_cmdline/Makefile       |  1 +
 lib/librte_cryptodev/Makefile     |  2 ++
 lib/librte_distributor/Makefile   |  1 +
 lib/librte_efd/Makefile           |  1 +
 lib/librte_ether/Makefile         |  2 ++
 lib/librte_eventdev/Makefile      |  1 +
 lib/librte_gro/Makefile           |  1 +
 lib/librte_gso/Makefile           |  2 ++
 lib/librte_hash/Makefile          |  1 +
 lib/librte_ip_frag/Makefile       |  2 ++
 lib/librte_jobstats/Makefile      |  1 +
 lib/librte_kni/Makefile           |  1 +
 lib/librte_kvargs/Makefile        |  1 +
 lib/librte_latencystats/Makefile  |  1 +
 lib/librte_lpm/Makefile           |  1 +
 lib/librte_mbuf/Makefile          |  1 +
 lib/librte_member/Makefile        |  1 +
 lib/librte_mempool/Makefile       |  1 +
 lib/librte_meter/Makefile         |  1 +
 lib/librte_metrics/Makefile       |  1 +
 lib/librte_net/Makefile           |  1 +
 lib/librte_pdump/Makefile         |  1 +
 lib/librte_pipeline/Makefile      |  2 ++
 lib/librte_port/Makefile          |  2 ++
 lib/librte_power/Makefile         |  1 +
 lib/librte_reorder/Makefile       |  1 +
 lib/librte_ring/Makefile          |  1 +
 lib/librte_sched/Makefile         |  2 ++
 lib/librte_table/Makefile         |  2 ++
 lib/librte_timer/Makefile         |  1 +
 lib/librte_vhost/Makefile         |  1 +
 mk/rte.extsubdir.mk               |  1 -
 mk/rte.lib.mk                     |  7 -------
 mk/rte.subdir.mk                  |  3 +--
 101 files changed, 151 insertions(+), 70 deletions(-)

diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index 6cb6466c5..4b29e3d81 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -33,9 +33,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
 
 DIRS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += dpaa
-DEPDIRS-dpaa = $(core-libs)
 
 DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
-DEPDIRS-fslmc = $(core-libs)
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/bus/dpaa/Makefile b/drivers/bus/dpaa/Makefile
index 61b64320b..f672f5400 100644
--- a/drivers/bus/dpaa/Makefile
+++ b/drivers/bus/dpaa/Makefile
@@ -72,5 +72,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += \
 
 # Link Pthread
 LDLIBS += -lpthread
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile
index 37da1b050..c08b2af9d 100644
--- a/drivers/bus/fslmc/Makefile
+++ b/drivers/bus/fslmc/Makefile
@@ -52,6 +52,8 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev
 
 # versioning export map
 EXPORT_MAP := rte_bus_fslmc_version.map
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index 7a719b9d3..07919e826 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -34,26 +34,15 @@ include $(RTE_SDK)/mk/rte.vars.mk
 core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_cryptodev
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm
-DEPDIRS-aesni_gcm = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
-DEPDIRS-aesni_mb = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += armv8
-DEPDIRS-armv8 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += openssl
-DEPDIRS-openssl = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat
-DEPDIRS-qat = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler
-DEPDIRS-scheduler = $(core-libs) librte_kvargs librte_reorder
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += snow3g
-DEPDIRS-snow3g = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += kasumi
-DEPDIRS-kasumi = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += zuc
-DEPDIRS-zuc = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += null
-DEPDIRS-null = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += dpaa2_sec
-DEPDIRS-dpaa2_sec = $(core-libs)
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/crypto/aesni_gcm/Makefile b/drivers/crypto/aesni_gcm/Makefile
index 6fca5e1c5..44979a4a6 100644
--- a/drivers/crypto/aesni_gcm/Makefile
+++ b/drivers/crypto/aesni_gcm/Makefile
@@ -53,6 +53,8 @@ EXPORT_MAP := rte_pmd_aesni_gcm_version.map
 CFLAGS += -I$(AESNI_MULTI_BUFFER_LIB_PATH)
 CFLAGS += -I$(AESNI_MULTI_BUFFER_LIB_PATH)/include
 LDLIBS += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_cryptodev
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm_pmd.c
diff --git a/drivers/crypto/aesni_mb/Makefile b/drivers/crypto/aesni_mb/Makefile
index 611d4123b..82c5191e4 100644
--- a/drivers/crypto/aesni_mb/Makefile
+++ b/drivers/crypto/aesni_mb/Makefile
@@ -53,6 +53,8 @@ EXPORT_MAP := rte_pmd_aesni_version.map
 CFLAGS += -I$(AESNI_MULTI_BUFFER_LIB_PATH)
 CFLAGS += -I$(AESNI_MULTI_BUFFER_LIB_PATH)/include
 LDLIBS += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_cryptodev
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd.c
diff --git a/drivers/crypto/armv8/Makefile b/drivers/crypto/armv8/Makefile
index 86611fa2e..fb3ec9a8f 100644
--- a/drivers/crypto/armv8/Makefile
+++ b/drivers/crypto/armv8/Makefile
@@ -57,6 +57,8 @@ EXPORT_MAP := rte_armv8_pmd_version.map
 CFLAGS += -I$(ARMV8_CRYPTO_LIB_PATH)
 CFLAGS += -I$(ARMV8_CRYPTO_LIB_PATH)/asm/include
 LDLIBS += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_cryptodev
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += rte_armv8_pmd.c
diff --git a/drivers/crypto/dpaa2_sec/Makefile b/drivers/crypto/dpaa2_sec/Makefile
index be6c94811..3f0eadeed 100644
--- a/drivers/crypto/dpaa2_sec/Makefile
+++ b/drivers/crypto/dpaa2_sec/Makefile
@@ -73,5 +73,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += mc/dpseci.c
 
 LDLIBS += -lrte_bus_fslmc
 LDLIBS += -lrte_mempool_dpaa2
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_cryptodev
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/kasumi/Makefile b/drivers/crypto/kasumi/Makefile
index b47cda0c5..b9daf454e 100644
--- a/drivers/crypto/kasumi/Makefile
+++ b/drivers/crypto/kasumi/Makefile
@@ -54,6 +54,8 @@ CFLAGS += -I$(LIBSSO_KASUMI_PATH)
 CFLAGS += -I$(LIBSSO_KASUMI_PATH)/include
 CFLAGS += -I$(LIBSSO_KASUMI_PATH)/build
 LDLIBS += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_cryptodev
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd.c
diff --git a/drivers/crypto/null/Makefile b/drivers/crypto/null/Makefile
index bc2724b39..b368161c3 100644
--- a/drivers/crypto/null/Makefile
+++ b/drivers/crypto/null/Makefile
@@ -37,6 +37,8 @@ LIB = librte_pmd_null_crypto.a
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_cryptodev
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/crypto/openssl/Makefile b/drivers/crypto/openssl/Makefile
index e5fdfb59b..85e5d8703 100644
--- a/drivers/crypto/openssl/Makefile
+++ b/drivers/crypto/openssl/Makefile
@@ -45,6 +45,8 @@ EXPORT_MAP := rte_pmd_openssl_version.map
 
 # external library dependencies
 LDLIBS += -lcrypto
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_cryptodev
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += rte_openssl_pmd.c
diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile
index 7322ffe4a..c38b80d4a 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/crypto/qat/Makefile
@@ -43,6 +43,8 @@ CFLAGS += -O3
 # external library include paths
 CFLAGS += -I$(SRCDIR)/qat_adf
 LDLIBS += -lcrypto
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_cryptodev
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat_crypto.c
diff --git a/drivers/crypto/scheduler/Makefile b/drivers/crypto/scheduler/Makefile
index b045410cd..b1a468e0a 100644
--- a/drivers/crypto/scheduler/Makefile
+++ b/drivers/crypto/scheduler/Makefile
@@ -36,6 +36,8 @@ LIB = librte_pmd_crypto_scheduler.a
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_cryptodev -lrte_kvargs -lrte_reorder
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/crypto/snow3g/Makefile b/drivers/crypto/snow3g/Makefile
index ecee80dfb..1fb057182 100644
--- a/drivers/crypto/snow3g/Makefile
+++ b/drivers/crypto/snow3g/Makefile
@@ -54,6 +54,8 @@ CFLAGS += -I$(LIBSSO_SNOW3G_PATH)
 CFLAGS += -I$(LIBSSO_SNOW3G_PATH)/include
 CFLAGS += -I$(LIBSSO_SNOW3G_PATH)/build
 LDLIBS += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_cryptodev
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd.c
diff --git a/drivers/crypto/zuc/Makefile b/drivers/crypto/zuc/Makefile
index f543b4073..9d03cf022 100644
--- a/drivers/crypto/zuc/Makefile
+++ b/drivers/crypto/zuc/Makefile
@@ -54,6 +54,8 @@ CFLAGS += -I$(LIBSSO_ZUC_PATH)
 CFLAGS += -I$(LIBSSO_ZUC_PATH)/include
 CFLAGS += -I$(LIBSSO_ZUC_PATH)/build
 LDLIBS += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_cryptodev
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd.c
diff --git a/drivers/event/Makefile b/drivers/event/Makefile
index 3f6b8988a..c1aae81fb 100644
--- a/drivers/event/Makefile
+++ b/drivers/event/Makefile
@@ -34,12 +34,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 core-libs := librte_eal librte_eventdev
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
-DEPDIRS-skeleton = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SW_EVENTDEV) += sw
-DEPDIRS-sw = $(core-libs) librte_kvargs librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx
-DEPDIRS-octeontx = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += dpaa2
-DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile
index 3497d09d8..7c5c7ee79 100644
--- a/drivers/event/dpaa2/Makefile
+++ b/drivers/event/dpaa2/Makefile
@@ -45,6 +45,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal
 CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa2
 CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
+LDLIBS += -lrte_eal -lrte_eventdev -lrte_bus_fslmc
 
 # versioning export map
 EXPORT_MAP := rte_pmd_dpaa2_event_version.map
diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile
index e5661ca82..a3a2dc10d 100644
--- a/drivers/event/octeontx/Makefile
+++ b/drivers/event/octeontx/Makefile
@@ -38,6 +38,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_pmd_octeontx_ssovf.a
 
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_eventdev
 
 EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map
 
diff --git a/drivers/event/skeleton/Makefile b/drivers/event/skeleton/Makefile
index e6d58711b..e4a9f4163 100644
--- a/drivers/event/skeleton/Makefile
+++ b/drivers/event/skeleton/Makefile
@@ -38,6 +38,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_pmd_skeleton_event.a
 
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_eventdev
 
 EXPORT_MAP := rte_pmd_skeleton_event_version.map
 
diff --git a/drivers/event/sw/Makefile b/drivers/event/sw/Makefile
index d6c14da92..61a108c50 100644
--- a/drivers/event/sw/Makefile
+++ b/drivers/event/sw/Makefile
@@ -43,6 +43,7 @@ ifeq ($(shell test $(GCC_VERSION) -le 50 && echo 1), 1)
 CFLAGS += -Wno-missing-field-initializers
 endif
 endif
+LDLIBS += -lrte_eal -lrte_eventdev -lrte_kvargs -lrte_ring
 
 # library version
 LIBABIVER := 1
diff --git a/drivers/mempool/Makefile b/drivers/mempool/Makefile
index 435b8fc31..1c5f2003e 100644
--- a/drivers/mempool/Makefile
+++ b/drivers/mempool/Makefile
@@ -33,14 +33,9 @@ include $(RTE_SDK)/mk/rte.vars.mk
 core-libs := librte_eal librte_mempool librte_ring
 
 DIRS-$(CONFIG_RTE_LIBRTE_DPAA_MEMPOOL) += dpaa
-DEPDIRS-dpaa = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += dpaa2
-DEPDIRS-dpaa2 = $(core-libs)
 DIRS-$(CONFIG_RTE_DRIVER_MEMPOOL_RING) += ring
-DEPDIRS-ring = $(core-libs)
 DIRS-$(CONFIG_RTE_DRIVER_MEMPOOL_STACK) += stack
-DEPDIRS-stack = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += octeontx
-DEPDIRS-octeontx = $(core-libs) librte_mbuf librte_pmd_octeontx_ssovf
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/mempool/dpaa/Makefile b/drivers/mempool/dpaa/Makefile
index 25312a014..c49b0ee37 100644
--- a/drivers/mempool/dpaa/Makefile
+++ b/drivers/mempool/dpaa/Makefile
@@ -54,5 +54,6 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA_MEMPOOL) += dpaa_mempool.c
 
 LDLIBS += -lrte_bus_dpaa
+LDLIBS += -lrte_eal -lrte_mempool -lrte_ring
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/mempool/dpaa2/Makefile b/drivers/mempool/dpaa2/Makefile
index 1a1749687..dd19e1003 100644
--- a/drivers/mempool/dpaa2/Makefile
+++ b/drivers/mempool/dpaa2/Makefile
@@ -58,5 +58,6 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += dpaa2_hw_mempool.c
 
 LDLIBS += -lrte_bus_fslmc
+LDLIBS += -lrte_eal -lrte_mempool -lrte_ring
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/mempool/octeontx/Makefile b/drivers/mempool/octeontx/Makefile
index 16e215092..f5dfab60e 100644
--- a/drivers/mempool/octeontx/Makefile
+++ b/drivers/mempool/octeontx/Makefile
@@ -67,5 +67,6 @@ CFLAGS_rte_mempool_octeontx.o += -Ofast
 endif
 
 LDLIBS += -lrte_pmd_octeontx_ssovf
+LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/mempool/ring/Makefile b/drivers/mempool/ring/Makefile
index b339d9078..a7889b96a 100644
--- a/drivers/mempool/ring/Makefile
+++ b/drivers/mempool/ring/Makefile
@@ -37,6 +37,7 @@ LIB = librte_mempool_ring.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mempool -lrte_ring
 
 EXPORT_MAP := rte_mempool_ring_version.map
 
diff --git a/drivers/mempool/stack/Makefile b/drivers/mempool/stack/Makefile
index 7577b23c3..f8d6c5745 100644
--- a/drivers/mempool/stack/Makefile
+++ b/drivers/mempool/stack/Makefile
@@ -40,6 +40,7 @@ CFLAGS += $(WERROR_FLAGS)
 
 # Headers
 CFLAGS += -I$(RTE_SDK)/lib/librte_mempool
+LDLIBS += -lrte_eal -lrte_mempool -lrte_ring
 
 EXPORT_MAP := rte_mempool_stack_version.map
 
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 5d2ad2f8a..cf3323340 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -40,84 +40,49 @@ core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
 core-libs += librte_net librte_kvargs
 
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += af_packet
-DEPDIRS-af_packet = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_ARK_PMD) += ark
-DEPDIRS-ark = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_AVP_PMD) += avp
-DEPDIRS-avp = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x
-DEPDIRS-bnx2x = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += bonding
-DEPDIRS-bonding = $(core-libs) librte_cmdline
 DIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe
-DEPDIRS-cxgbe = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_DPAA_PMD) += dpaa
-DEPDIRS-dpaa = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2
-DEPDIRS-dpaa2 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000
-DEPDIRS-e1000 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena
-DEPDIRS-ena = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic
-DEPDIRS-enic = $(core-libs) librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_FAILSAFE) += failsafe
-DEPDIRS-failsafe = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
-DEPDIRS-fm10k = $(core-libs) librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
-DEPDIRS-i40e = $(core-libs) librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
-DEPDIRS-ixgbe = $(core-libs) librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += liquidio
-DEPDIRS-liquidio = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
-DEPDIRS-mlx4 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5
-DEPDIRS-mlx5 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_MRVL_PMD) += mrvl
-DEPDIRS-mrvl = $(core-libs) librte_cfgfile
 DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp
-DEPDIRS-nfp = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt
-DEPDIRS-bnxt = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null
-DEPDIRS-null = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX_PMD) += octeontx
-DEPDIRS-octeontx = $(core-libs) librte_eventdev librte_pmd_octeontx_ssovf
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap
-DEPDIRS-pcap = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede
-DEPDIRS-qede = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += ring
-DEPDIRS-ring = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += sfc
-DEPDIRS-sfc = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += szedata2
-DEPDIRS-szedata2 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += tap
-DEPDIRS-tap = $(core-libs) librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += thunderx
-DEPDIRS-thunderx = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
-DEPDIRS-virtio = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
-DEPDIRS-vmxnet3 = $(core-libs)
 
 ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_KNI) += kni
 endif
-DEPDIRS-kni = $(core-libs) librte_kni
 
 ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SOFTNIC) += softnic
 endif # $(CONFIG_RTE_LIBRTE_SCHED)
-DEPDIRS-softnic = $(core-libs) librte_sched
 
 ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += vhost
 endif # $(CONFIG_RTE_LIBRTE_VHOST)
-DEPDIRS-vhost = $(core-libs) librte_vhost
 
 ifeq ($(CONFIG_RTE_LIBRTE_MRVL_PMD),y)
 ifeq ($(CONFIG_RTE_LIBRTE_CFGFILE),n)
diff --git a/drivers/net/af_packet/Makefile b/drivers/net/af_packet/Makefile
index 70d517c16..b97c2a627 100644
--- a/drivers/net/af_packet/Makefile
+++ b/drivers/net/af_packet/Makefile
@@ -44,6 +44,8 @@ LIBABIVER := 1
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 #
 # all source are stored in SRCS-y
diff --git a/drivers/net/ark/Makefile b/drivers/net/ark/Makefile
index ca64b1957..5f704152d 100644
--- a/drivers/net/ark/Makefile
+++ b/drivers/net/ark/Makefile
@@ -62,5 +62,7 @@ LDLIBS += -lpthread
 ifdef CONFIG_RTE_EXEC_ENV_LINUXAPP
 LDLIBS += -ldl
 endif
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/avp/Makefile b/drivers/net/avp/Makefile
index cd465aac9..a754fa06b 100644
--- a/drivers/net/avp/Makefile
+++ b/drivers/net/avp/Makefile
@@ -39,6 +39,8 @@ LIB = librte_pmd_avp.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_avp_version.map
 
diff --git a/drivers/net/bnx2x/Makefile b/drivers/net/bnx2x/Makefile
index e12310691..762d42ee3 100644
--- a/drivers/net/bnx2x/Makefile
+++ b/drivers/net/bnx2x/Makefile
@@ -9,6 +9,8 @@ CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -DZLIB_CONST
 LDLIBS += -lz
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_bnx2x_version.map
 
diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile
index 55b49b538..7aed17e66 100644
--- a/drivers/net/bnxt/Makefile
+++ b/drivers/net/bnxt/Makefile
@@ -44,6 +44,8 @@ LIBABIVER := 2
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_bnxt_version.map
 
diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile
index d9a918e91..84ef4edcf 100644
--- a/drivers/net/bonding/Makefile
+++ b/drivers/net/bonding/Makefile
@@ -38,6 +38,8 @@ LIB = librte_pmd_bond.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_cmdline
 
 EXPORT_MAP := rte_pmd_bond_version.map
 
diff --git a/drivers/net/cxgbe/Makefile b/drivers/net/cxgbe/Makefile
index 7cef6279c..37e3dad0e 100644
--- a/drivers/net/cxgbe/Makefile
+++ b/drivers/net/cxgbe/Makefile
@@ -62,6 +62,8 @@ endif
 CFLAGS_BASE_DRIVER =
 
 endif
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 #
 # Add extra flags for base driver files (also known as shared code)
diff --git a/drivers/net/dpaa/Makefile b/drivers/net/dpaa/Makefile
index c77384c9f..171686ecf 100644
--- a/drivers/net/dpaa/Makefile
+++ b/drivers/net/dpaa/Makefile
@@ -57,5 +57,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA_PMD) += dpaa_rxtx.c
 
 LDLIBS += -lrte_bus_dpaa
 LDLIBS += -lrte_mempool_dpaa
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/dpaa2/Makefile b/drivers/net/dpaa2/Makefile
index 2f551d55e..ee9b2ccea 100644
--- a/drivers/net/dpaa2/Makefile
+++ b/drivers/net/dpaa2/Makefile
@@ -67,5 +67,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpkg.c
 
 LDLIBS += -lrte_bus_fslmc
 LDLIBS += -lrte_mempool_dpaa2
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
index ffdf36d37..69649ad03 100644
--- a/drivers/net/e1000/Makefile
+++ b/drivers/net/e1000/Makefile
@@ -38,6 +38,8 @@ LIB = librte_pmd_e1000.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_e1000_version.map
 
diff --git a/drivers/net/ena/Makefile b/drivers/net/ena/Makefile
index bf1f5da07..1cab5e2e4 100644
--- a/drivers/net/ena/Makefile
+++ b/drivers/net/ena/Makefile
@@ -52,5 +52,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena_com.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena_eth_com.c
 
 CFLAGS += $(INCLUDES)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enic/Makefile b/drivers/net/enic/Makefile
index db48ff2da..6a99a9909 100644
--- a/drivers/net/enic/Makefile
+++ b/drivers/net/enic/Makefile
@@ -45,6 +45,8 @@ CFLAGS += -I$(SRCDIR)/base/
 CFLAGS += -I$(SRCDIR)
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -Wno-strict-aliasing
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
 
 VPATH += $(SRCDIR)/src
 
diff --git a/drivers/net/failsafe/Makefile b/drivers/net/failsafe/Makefile
index d516d3621..e533d54d9 100644
--- a/drivers/net/failsafe/Makefile
+++ b/drivers/net/failsafe/Makefile
@@ -58,5 +58,7 @@ CFLAGS += -D_XOPEN_SOURCE=700
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -Wno-strict-prototypes
 CFLAGS += -pedantic
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/fm10k/Makefile b/drivers/net/fm10k/Makefile
index e0024f052..89aec4dc6 100644
--- a/drivers/net/fm10k/Makefile
+++ b/drivers/net/fm10k/Makefile
@@ -76,6 +76,8 @@ CFLAGS_BASE_DRIVER += -Wno-implicit-fallthrough
 endif
 endif
 endif
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
 
 #
 # Add extra flags for base driver source files to disable warnings in them
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 1290d7f32..ea7cf87e8 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -39,6 +39,8 @@ LIB = librte_pmd_i40e.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -DPF_DRIVER -DVF_DRIVER -DINTEGRATED_VF
 CFLAGS += -DX722_A0_SUPPORT
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
 
 EXPORT_MAP := rte_pmd_i40e_version.map
 
diff --git a/drivers/net/ixgbe/Makefile b/drivers/net/ixgbe/Makefile
index 18ad4feca..d1ed562dc 100644
--- a/drivers/net/ixgbe/Makefile
+++ b/drivers/net/ixgbe/Makefile
@@ -82,6 +82,8 @@ endif
 endif
 
 endif
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
 
 #
 # Add extra flags for base driver files (also known as shared code)
diff --git a/drivers/net/kni/Makefile b/drivers/net/kni/Makefile
index 46a1ad08a..00d099fd2 100644
--- a/drivers/net/kni/Makefile
+++ b/drivers/net/kni/Makefile
@@ -38,6 +38,8 @@ LIB = librte_pmd_kni.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 LDLIBS += -lpthread
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_kni
 
 EXPORT_MAP := rte_pmd_kni_version.map
 
diff --git a/drivers/net/liquidio/Makefile b/drivers/net/liquidio/Makefile
index 32c06f5b0..79120d1b2 100644
--- a/drivers/net/liquidio/Makefile
+++ b/drivers/net/liquidio/Makefile
@@ -40,6 +40,8 @@ LIB = librte_pmd_lio.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)/base -I$(SRCDIR)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_lio_version.map
 
diff --git a/drivers/net/mlx4/Makefile b/drivers/net/mlx4/Makefile
index 0515cd7ef..0d7209995 100644
--- a/drivers/net/mlx4/Makefile
+++ b/drivers/net/mlx4/Makefile
@@ -55,6 +55,8 @@ CFLAGS += -D_DEFAULT_SOURCE
 CFLAGS += -D_XOPEN_SOURCE=600
 CFLAGS += $(WERROR_FLAGS)
 LDLIBS += -libverbs
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 # A few warnings cannot be avoided in external headers.
 CFLAGS += -Wno-error=cast-qual
diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index 2e90692ed..e78840f66 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -65,6 +65,8 @@ CFLAGS += -D_XOPEN_SOURCE=600
 CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -Wno-strict-prototypes
 LDLIBS += -libverbs -lmlx5
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 # A few warnings cannot be avoided in external headers.
 CFLAGS += -Wno-error=cast-qual
diff --git a/drivers/net/mrvl/Makefile b/drivers/net/mrvl/Makefile
index 26fce1818..cd5651900 100644
--- a/drivers/net/mrvl/Makefile
+++ b/drivers/net/mrvl/Makefile
@@ -55,6 +55,8 @@ CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -O3
 LDLIBS += -L$(LIBMUSDK_PATH)/lib
 LDLIBS += -lmusdk
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_cfgfile
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_MRVL_PMD) += mrvl_ethdev.c
diff --git a/drivers/net/nfp/Makefile b/drivers/net/nfp/Makefile
index 3e4c6f405..c1e51cbee 100644
--- a/drivers/net/nfp/Makefile
+++ b/drivers/net/nfp/Makefile
@@ -40,6 +40,8 @@ CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
 LDLIBS += -lm
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_nfp_version.map
 
diff --git a/drivers/net/null/Makefile b/drivers/net/null/Makefile
index 77810bced..c2404f4a2 100644
--- a/drivers/net/null/Makefile
+++ b/drivers/net/null/Makefile
@@ -38,6 +38,8 @@ LIB = librte_pmd_null.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_null_version.map
 
diff --git a/drivers/net/octeontx/Makefile b/drivers/net/octeontx/Makefile
index 4d6c67c54..79c7ea2ca 100644
--- a/drivers/net/octeontx/Makefile
+++ b/drivers/net/octeontx/Makefile
@@ -63,5 +63,7 @@ CFLAGS_octeontx_rxtx.o += -O3 -Ofast
 
 LDLIBS += -lrte_eventdev
 LDLIBS += -lrte_pmd_octeontx_ssovf
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/pcap/Makefile b/drivers/net/pcap/Makefile
index 7ebd0bef2..9ea96700a 100644
--- a/drivers/net/pcap/Makefile
+++ b/drivers/net/pcap/Makefile
@@ -40,6 +40,8 @@ LIB = librte_pmd_pcap.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 LDLIBS += -lpcap
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_pcap_version.map
 
diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index f03441d9a..d4b96d46d 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -13,6 +13,8 @@ LIB = librte_pmd_qede.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_qede_version.map
 
diff --git a/drivers/net/ring/Makefile b/drivers/net/ring/Makefile
index 7ae15ef44..9edd7d5ca 100644
--- a/drivers/net/ring/Makefile
+++ b/drivers/net/ring/Makefile
@@ -38,6 +38,8 @@ LIB = librte_pmd_ring.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_ring_version.map
 
diff --git a/drivers/net/sfc/Makefile b/drivers/net/sfc/Makefile
index 0adb786b8..2d044aefc 100644
--- a/drivers/net/sfc/Makefile
+++ b/drivers/net/sfc/Makefile
@@ -69,6 +69,8 @@ CFLAGS_BASE_DRIVER += -Wno-unused-but-set-variable
 # value is set
 CFLAGS_sfc_ef10_tx.o += -wd3656
 endif
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 #
 # List of base driver object files for which
diff --git a/drivers/net/softnic/Makefile b/drivers/net/softnic/Makefile
index 8b848a9d2..4b15f003c 100644
--- a/drivers/net/softnic/Makefile
+++ b/drivers/net/softnic/Makefile
@@ -38,6 +38,8 @@ LIB = librte_pmd_softnic.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_sched
 
 EXPORT_MAP := rte_pmd_eth_softnic_version.map
 
diff --git a/drivers/net/szedata2/Makefile b/drivers/net/szedata2/Makefile
index 0e96b922c..f38125d3d 100644
--- a/drivers/net/szedata2/Makefile
+++ b/drivers/net/szedata2/Makefile
@@ -39,6 +39,8 @@ LIB = librte_pmd_szedata2.a
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 LDLIBS += -lsze2
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_szedata2_version.map
 
diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile
index b0de02843..b5c5a3576 100644
--- a/drivers/net/tap/Makefile
+++ b/drivers/net/tap/Makefile
@@ -43,6 +43,8 @@ CFLAGS += -O3
 CFLAGS += -I$(SRCDIR)
 CFLAGS += -I.
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_hash
 
 #
 # all source are stored in SRCS-y
diff --git a/drivers/net/thunderx/Makefile b/drivers/net/thunderx/Makefile
index 915ae945a..aa0514313 100644
--- a/drivers/net/thunderx/Makefile
+++ b/drivers/net/thunderx/Makefile
@@ -40,6 +40,8 @@ LIB = librte_pmd_thunderx_nicvf.a
 CFLAGS += $(WERROR_FLAGS)
 
 LDLIBS += -lm
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_thunderx_nicvf_version.map
 
diff --git a/drivers/net/vhost/Makefile b/drivers/net/vhost/Makefile
index 258a917c7..1085a5238 100644
--- a/drivers/net/vhost/Makefile
+++ b/drivers/net/vhost/Makefile
@@ -37,6 +37,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_pmd_vhost.a
 
 LDLIBS += -lpthread
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -lrte_vhost
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
diff --git a/drivers/net/virtio/Makefile b/drivers/net/virtio/Makefile
index b21b87814..156b2e848 100644
--- a/drivers/net/virtio/Makefile
+++ b/drivers/net/virtio/Makefile
@@ -38,6 +38,8 @@ LIB = librte_pmd_virtio.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 EXPORT_MAP := rte_pmd_virtio_version.map
 
diff --git a/drivers/net/vmxnet3/Makefile b/drivers/net/vmxnet3/Makefile
index 84356ae22..9359a7bd3 100644
--- a/drivers/net/vmxnet3/Makefile
+++ b/drivers/net/vmxnet3/Makefile
@@ -63,6 +63,8 @@ CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value
 CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args
 
 endif
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
 
 VPATH += $(SRCDIR)/base
 
diff --git a/examples/ethtool/Makefile b/examples/ethtool/Makefile
index 30b42b70e..e86d68ace 100644
--- a/examples/ethtool/Makefile
+++ b/examples/ethtool/Makefile
@@ -47,6 +47,5 @@ DIRS-y += lib ethtool-app
 endif
 
 DEPDIRS-ethtool-app := lib
-DEPDIRS-lib := librte_eal librte_ether
 
 include $(RTE_SDK)/mk/rte.extsubdir.mk
diff --git a/examples/ethtool/lib/Makefile b/examples/ethtool/lib/Makefile
index 266babade..cabd82a0e 100644
--- a/examples/ethtool/lib/Makefile
+++ b/examples/ethtool/lib/Makefile
@@ -59,5 +59,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
 LDLIBS += -lrte_pmd_ixgbe
 endif
 endif
+LDLIBS += -lrte_eal -lrte_ethdev
 
 include $(RTE_SDK)/mk/rte.extlib.mk
diff --git a/lib/Makefile b/lib/Makefile
index 86d475f3e..527b95b56 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -110,11 +110,12 @@ DEPDIRS-librte_reorder := librte_eal librte_mempool librte_mbuf
 DIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += librte_pdump
 DEPDIRS-librte_pdump := librte_eal librte_mempool librte_mbuf librte_ether
 DIRS-$(CONFIG_RTE_LIBRTE_GSO) += librte_gso
-DEPDIRS-librte_gso := librte_eal librte_mbuf librte_ether librte_net librte_mempool
+DEPDIRS-librte_gso := librte_eal librte_mbuf librte_ether librte_net
+DEPDIRS-librte_gso += librte_mempool
 
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
 DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni
 endif
-DEPDIRS-librte_kni:= librte_eal librte_mempool librte_mbuf librte_ether
+DEPDIRS-librte_kni := librte_eal librte_mempool librte_mbuf librte_ether
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 59767920a..e7e3c91d5 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -36,6 +36,7 @@ LIB = librte_acl.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+LDLIBS += -lrte_eal
 
 EXPORT_MAP := rte_acl_version.map
 
diff --git a/lib/librte_bitratestats/Makefile b/lib/librte_bitratestats/Makefile
index a079cced7..5054b6798 100644
--- a/lib/librte_bitratestats/Makefile
+++ b/lib/librte_bitratestats/Makefile
@@ -35,6 +35,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_bitratestats.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+LDLIBS += -lrte_eal -lrte_metrics -lrte_ethdev
 
 EXPORT_MAP := rte_bitratestats_version.map
 
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index 644f68e47..2c48e62b7 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -54,6 +54,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_socket.c
 SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_parse_portlist.c
 
 CFLAGS += -D_GNU_SOURCE
+LDLIBS += -lrte_eal
 
 # install includes
 INCS := cmdline.h cmdline_parse.h cmdline_parse_num.h cmdline_parse_ipaddr.h
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index 6ac331bc9..bb58ea17a 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -39,6 +39,8 @@ LIBABIVER := 3
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mempool -lrte_ring -lrte_mbuf
+LDLIBS += -lrte_kvargs
 
 # library source files
 SRCS-y += rte_cryptodev.c rte_cryptodev_pmd.c
diff --git a/lib/librte_distributor/Makefile b/lib/librte_distributor/Makefile
index b417ee7be..fee001213 100644
--- a/lib/librte_distributor/Makefile
+++ b/lib/librte_distributor/Makefile
@@ -36,6 +36,7 @@ LIB = librte_distributor.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_ethdev
 
 EXPORT_MAP := rte_distributor_version.map
 
diff --git a/lib/librte_efd/Makefile b/lib/librte_efd/Makefile
index b9277bc5d..16e450e8d 100644
--- a/lib/librte_efd/Makefile
+++ b/lib/librte_efd/Makefile
@@ -36,6 +36,7 @@ LIB = librte_efd.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+LDLIBS += -lrte_eal -lrte_ring -lrte_hash
 
 EXPORT_MAP := rte_efd_version.map
 
diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile
index edcddf70d..985fd1b90 100644
--- a/lib/librte_ether/Makefile
+++ b/lib/librte_ether/Makefile
@@ -38,6 +38,8 @@ LIB = librte_ethdev.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_net -lrte_eal -lrte_mempool -lrte_ring
+LDLIBS += -lrte_mbuf
 
 EXPORT_MAP := rte_ethdev_version.map
 
diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile
index daa4ef1d9..5ac22cde7 100644
--- a/lib/librte_eventdev/Makefile
+++ b/lib/librte_eventdev/Makefile
@@ -39,6 +39,7 @@ LIBABIVER := 3
 # build flags
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_ring -lrte_ethdev -lrte_hash
 
 # library source files
 SRCS-y += rte_eventdev.c
diff --git a/lib/librte_gro/Makefile b/lib/librte_gro/Makefile
index 747eeec9e..eb423ccba 100644
--- a/lib/librte_gro/Makefile
+++ b/lib/librte_gro/Makefile
@@ -36,6 +36,7 @@ LIB = librte_gro.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_ethdev -lrte_net
 
 EXPORT_MAP := rte_gro_version.map
 
diff --git a/lib/librte_gso/Makefile b/lib/librte_gso/Makefile
index e6d41df7d..ea5ad7421 100644
--- a/lib/librte_gso/Makefile
+++ b/lib/librte_gso/Makefile
@@ -35,6 +35,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_gso.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_ethdev -lrte_net
+LDLIBS += -lrte_mempool
 
 EXPORT_MAP := rte_gso_version.map
 
diff --git a/lib/librte_hash/Makefile b/lib/librte_hash/Makefile
index 9cf13a045..1655b601d 100644
--- a/lib/librte_hash/Makefile
+++ b/lib/librte_hash/Makefile
@@ -36,6 +36,7 @@ LIB = librte_hash.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+LDLIBS += -lrte_eal -lrte_ring
 
 EXPORT_MAP := rte_hash_version.map
 
diff --git a/lib/librte_ip_frag/Makefile b/lib/librte_ip_frag/Makefile
index 2a8c3e374..aff94b8ca 100644
--- a/lib/librte_ip_frag/Makefile
+++ b/lib/librte_ip_frag/Makefile
@@ -36,6 +36,8 @@ LIB = librte_ip_frag.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev
+LDLIBS += -lrte_hash
 
 EXPORT_MAP := rte_ip_frag_version.map
 
diff --git a/lib/librte_jobstats/Makefile b/lib/librte_jobstats/Makefile
index 561a0678c..d0bddd126 100644
--- a/lib/librte_jobstats/Makefile
+++ b/lib/librte_jobstats/Makefile
@@ -36,6 +36,7 @@ LIB = librte_jobstats.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+LDLIBS += -lrte_eal
 
 EXPORT_MAP := rte_jobstats_version.map
 
diff --git a/lib/librte_kni/Makefile b/lib/librte_kni/Makefile
index 70f1ca8f6..56b197604 100644
--- a/lib/librte_kni/Makefile
+++ b/lib/librte_kni/Makefile
@@ -35,6 +35,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_kni.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev
 
 EXPORT_MAP := rte_kni_version.map
 
diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
index 564dd3102..4eaa9334d 100644
--- a/lib/librte_kvargs/Makefile
+++ b/lib/librte_kvargs/Makefile
@@ -37,6 +37,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_kvargs.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+LDLIBS += -lrte_eal
 
 EXPORT_MAP := rte_kvargs_version.map
 
diff --git a/lib/librte_latencystats/Makefile b/lib/librte_latencystats/Makefile
index eaacbb731..665c7b414 100644
--- a/lib/librte_latencystats/Makefile
+++ b/lib/librte_latencystats/Makefile
@@ -36,6 +36,7 @@ LIB = librte_latencystats.a
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
 LDLIBS += -lm
 LDLIBS += -lpthread
+LDLIBS += -lrte_eal -lrte_metrics -lrte_ethdev -lrte_mbuf
 
 EXPORT_MAP := rte_latencystats_version.map
 
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 32be46b3b..2e8749e84 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -36,6 +36,7 @@ LIB = librte_lpm.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+LDLIBS += -lrte_eal
 
 EXPORT_MAP := rte_lpm_version.map
 
diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 548273054..f6be35366 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -35,6 +35,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_mbuf.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+LDLIBS += -lrte_eal -lrte_mempool
 
 EXPORT_MAP := rte_mbuf_version.map
 
diff --git a/lib/librte_member/Makefile b/lib/librte_member/Makefile
index 3bac1d0ab..f4cf101e7 100644
--- a/lib/librte_member/Makefile
+++ b/lib/librte_member/Makefile
@@ -38,6 +38,7 @@ CFLAGS := -I$(SRCDIR) $(CFLAGS)
 CFLAGS += $(WERROR_FLAGS) -O3
 
 LDLIBS += -lm
+LDLIBS += -lrte_eal -lrte_hash
 
 EXPORT_MAP := rte_member_version.map
 
diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
index 7b5bdfee7..bafd1b9a0 100644
--- a/lib/librte_mempool/Makefile
+++ b/lib/librte_mempool/Makefile
@@ -35,6 +35,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_mempool.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+LDLIBS += -lrte_eal -lrte_ring
 
 EXPORT_MAP := rte_mempool_version.map
 
diff --git a/lib/librte_meter/Makefile b/lib/librte_meter/Makefile
index 539bfddd8..bfeb5d60c 100644
--- a/lib/librte_meter/Makefile
+++ b/lib/librte_meter/Makefile
@@ -40,6 +40,7 @@ CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
 LDLIBS += -lm
+LDLIBS += -lrte_eal
 
 EXPORT_MAP := rte_meter_version.map
 
diff --git a/lib/librte_metrics/Makefile b/lib/librte_metrics/Makefile
index d4990e839..a6efba4a1 100644
--- a/lib/librte_metrics/Makefile
+++ b/lib/librte_metrics/Makefile
@@ -35,6 +35,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_metrics.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+LDLIBS += -lrte_eal
 
 EXPORT_MAP := rte_metrics_version.map
 
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 56727c4df..cdaf0c7ff 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -34,6 +34,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_net.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+LDLIBS += -lrte_mbuf -lrte_eal
 
 EXPORT_MAP := rte_net_version.map
 LIBABIVER := 1
diff --git a/lib/librte_pdump/Makefile b/lib/librte_pdump/Makefile
index 6b21c62e5..11c3e4e93 100644
--- a/lib/librte_pdump/Makefile
+++ b/lib/librte_pdump/Makefile
@@ -37,6 +37,7 @@ LIB = librte_pdump.a
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
 CFLAGS += -D_GNU_SOURCE
 LDLIBS += -lpthread
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev
 
 EXPORT_MAP := rte_pdump_version.map
 
diff --git a/lib/librte_pipeline/Makefile b/lib/librte_pipeline/Makefile
index 7a835fd55..a82857380 100644
--- a/lib/librte_pipeline/Makefile
+++ b/lib/librte_pipeline/Makefile
@@ -38,6 +38,8 @@ LIB = librte_pipeline.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_table
+LDLIBS += -lrte_port
 
 EXPORT_MAP := rte_pipeline_version.map
 
diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile
index 76629a13a..e761ef4a7 100644
--- a/lib/librte_port/Makefile
+++ b/lib/librte_port/Makefile
@@ -38,6 +38,8 @@ LIB = librte_port.a
 ifeq ($(CONFIG_RTE_PORT_PCAP),y)
 LDLIBS += -lpcap
 endif
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev
+LDLIBS += -lrte_ip_frag -lrte_sched -lrte_kni
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index 06cd10e86..1b1491d72 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -35,6 +35,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_power.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
+LDLIBS += -lrte_eal
 
 EXPORT_MAP := rte_power_version.map
 
diff --git a/lib/librte_reorder/Makefile b/lib/librte_reorder/Makefile
index 4e44e72f0..5d38d712d 100644
--- a/lib/librte_reorder/Makefile
+++ b/lib/librte_reorder/Makefile
@@ -36,6 +36,7 @@ LIB = librte_reorder.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf
 
 EXPORT_MAP := rte_reorder_version.map
 
diff --git a/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
index 3e2f4b873..e34d9d951 100644
--- a/lib/librte_ring/Makefile
+++ b/lib/librte_ring/Makefile
@@ -35,6 +35,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_ring.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+LDLIBS += -lrte_eal
 
 EXPORT_MAP := rte_ring_version.map
 
diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
index 18274e73c..89fc7d5c7 100644
--- a/lib/librte_sched/Makefile
+++ b/lib/librte_sched/Makefile
@@ -43,6 +43,8 @@ CFLAGS_rte_red.o := -D_GNU_SOURCE
 
 LDLIBS += -lm
 LDLIBS += -lrt
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_net
+LDLIBS += -lrte_timer
 
 EXPORT_MAP := rte_sched_version.map
 
diff --git a/lib/librte_table/Makefile b/lib/librte_table/Makefile
index 8ddc8804f..706a2de08 100644
--- a/lib/librte_table/Makefile
+++ b/lib/librte_table/Makefile
@@ -38,6 +38,8 @@ LIB = librte_table.a
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_port
+LDLIBS += -lrte_lpm -lrte_hash -lrte_acl
 
 EXPORT_MAP := rte_table_version.map
 
diff --git a/lib/librte_timer/Makefile b/lib/librte_timer/Makefile
index 03a15390e..eb9c5624d 100644
--- a/lib/librte_timer/Makefile
+++ b/lib/librte_timer/Makefile
@@ -35,6 +35,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_timer.a
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+LDLIBS += -lrte_eal
 
 EXPORT_MAP := rte_timer_version.map
 
diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
index e1084aba5..be182798a 100644
--- a/lib/librte_vhost/Makefile
+++ b/lib/librte_vhost/Makefile
@@ -45,6 +45,7 @@ LDLIBS += -lpthread
 ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
 LDLIBS += -lnuma
 endif
+LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev
 
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c iotlb.c socket.c vhost.c \
diff --git a/mk/rte.extsubdir.mk b/mk/rte.extsubdir.mk
index d21791b0c..e2ef0132a 100644
--- a/mk/rte.extsubdir.mk
+++ b/mk/rte.extsubdir.mk
@@ -52,7 +52,6 @@ $(DIRS-y):
 		BASE_OUTPUT=$(BASE_OUTPUT) \
 		CUR_SUBDIR=$(CUR_SUBDIR)/$(@) \
 		S=$(CURDIR)/$(@) \
-		DEPDIRS="$(DEPDIRS-$@)" \
 		$(filter-out $(DIRS-y),$(MAKECMDGOALS))
 
 define depdirs_rule
diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index 13115d146..8efef04a9 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -84,13 +84,6 @@ else
 _CPU_LDFLAGS := $(CPU_LDFLAGS)
 endif
 
-# Translate DEPDIRS into LDLIBS
-# Ignore (sub)directory dependencies which do not provide an actual library
-_IGNORE_DIRS = librte_eal/% librte_compat
-_DEPDIRS = $(filter-out $(_IGNORE_DIRS),$(DEPDIRS))
-_LDDIRS = $(subst librte_ether,librte_ethdev,$(_DEPDIRS))
-LDLIBS += $(subst 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 $(@)")
diff --git a/mk/rte.subdir.mk b/mk/rte.subdir.mk
index 92f5de4c8..6c393eb79 100644
--- a/mk/rte.subdir.mk
+++ b/mk/rte.subdir.mk
@@ -62,8 +62,7 @@ build: _postbuild
 $(DIRS-y):
 	@[ -d $(CURDIR)/$@ ] || mkdir -p $(CURDIR)/$@
 	@echo "== Build $S/$@"
-	@$(MAKE) S=$S/$@ -f $(SRCDIR)/$@/Makefile -C $(CURDIR)/$@ \
-		DEPDIRS="$(DEPDIRS-$@)" all
+	@$(MAKE) S=$S/$@ -f $(SRCDIR)/$@/Makefile -C $(CURDIR)/$@ all
 
 .PHONY: clean
 clean: _postclean
-- 
2.11.0



More information about the dev mailing list