DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Inter-PMD dependencies when building shared libraries
@ 2017-10-02 20:48 Eads, Gage
  2017-10-05 12:12 ` Olivier MATZ
  0 siblings, 1 reply; 11+ messages in thread
From: Eads, Gage @ 2017-10-02 20:48 UTC (permalink / raw)
  To: dev; +Cc: Olivier Matz, 'Jacob,  Jerin', santosh.shukla

I believe I've spotted an issue in the way inter-PMD dependencies are handled when building shared libraries. The depdirs_rule in mk/rte.subdir.mk relies on DEPDIRS-xyz containing the names of subdirectories that xyz depends on. In mk/rte.lib.mk, these DEPDIRS are converted into LDLIBS. This works when the subdirectory names match the library names (i.e. any of the libraries under lib/). However when the dependency is on a PMD, the subdirectory and library names don't match.

This is a problem, for example, in a patch for the net/octeontx PMD, which has a dependency on the event/octeontx PMD: http://dpdk.org/ml/archives/dev/2017-August/073983.html

I've reproduced this with a contrived example, by making the failsafe PMD depend on the NULL PMD in drivers/net/Makefile:
-DEPDIRS-failsafe = $(core-libs)
+DEPDIRS-failsafe = $(core-libs) librte_pmd_null

You can reproduce the build failure by running this command:
./devtools/test-build.sh x86_64-native-linuxapp-gcc+CONFIG_RTE_BUILD_SHARED_LIB

I'm no expert on DPDK's dependency handling code, but one option is to modify rte.lib.mk like so:
-LDLIBS += $(subst lib,-l,$(_LDDIRS))
+LDLIBS += $(subst lib,-l,$(filter lib%,$(_LDDIRS)))

Then you could put the PMD's directory name in DEPDIRs, and specify the depended-on library in the PMD's LDLIBS (as is done in the aforementioned net/octeontx PMD).

Thoughts?

Thanks,
Gage

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] Inter-PMD dependencies when building shared libraries
  2017-10-02 20:48 [dpdk-dev] Inter-PMD dependencies when building shared libraries Eads, Gage
@ 2017-10-05 12:12 ` Olivier MATZ
  2017-10-05 12:32   ` Thomas Monjalon
  0 siblings, 1 reply; 11+ messages in thread
From: Olivier MATZ @ 2017-10-05 12:12 UTC (permalink / raw)
  To: Eads, Gage
  Cc: dev, 'Jacob,  Jerin',
	santosh.shukla, Thomas Monjalon, bruce.richardson

Hi Gage,

+CC Thomas, Bruce

On Mon, Oct 02, 2017 at 08:48:29PM +0000, Eads, Gage wrote:
> I believe I've spotted an issue in the way inter-PMD dependencies are handled when building shared libraries. The depdirs_rule in mk/rte.subdir.mk relies on DEPDIRS-xyz containing the names of subdirectories that xyz depends on. In mk/rte.lib.mk, these DEPDIRS are converted into LDLIBS. This works when the subdirectory names match the library names (i.e. any of the libraries under lib/). However when the dependency is on a PMD, the subdirectory and library names don't match.
> 
> This is a problem, for example, in a patch for the net/octeontx PMD, which has a dependency on the event/octeontx PMD: http://dpdk.org/ml/archives/dev/2017-August/073983.html
> 
> I've reproduced this with a contrived example, by making the failsafe PMD depend on the NULL PMD in drivers/net/Makefile:
> -DEPDIRS-failsafe = $(core-libs)
> +DEPDIRS-failsafe = $(core-libs) librte_pmd_null
> 
> You can reproduce the build failure by running this command:
> ./devtools/test-build.sh x86_64-native-linuxapp-gcc+CONFIG_RTE_BUILD_SHARED_LIB
> 
> I'm no expert on DPDK's dependency handling code, but one option is to modify rte.lib.mk like so:
> -LDLIBS += $(subst lib,-l,$(_LDDIRS))
> +LDLIBS += $(subst lib,-l,$(filter lib%,$(_LDDIRS)))
> 
> Then you could put the PMD's directory name in DEPDIRs, and specify the depended-on library in the PMD's LDLIBS (as is done in the aforementioned net/octeontx PMD).
> 
> Thoughts?

Thanks for spotting this. Indeed, generating the "-l lib" LDFLAG from
DEPDIR doesn't work for PMDs. Here is the list of libraries whose directory
name is different than library name:

$ git grep "LIB = " | while read line; do dir=$(basename ${line%/Makefile*}); lib=${line#*= }; lib=${lib%*.a}; if [ "$dir" != "$lib" ]; then echo "${dir} ${lib}"; fi; done
fslmc librte_bus_fslmc
aesni_gcm librte_pmd_aesni_gcm
aesni_mb librte_pmd_aesni_mb
armv8 librte_pmd_armv8
dpaa2_sec librte_pmd_dpaa2_sec
kasumi librte_pmd_kasumi
null librte_pmd_null_crypto
openssl librte_pmd_openssl
qat librte_pmd_qat
scheduler librte_pmd_crypto_scheduler
snow3g librte_pmd_snow3g
zuc librte_pmd_zuc
dpaa2 librte_pmd_dpaa2_event
octeontx librte_pmd_octeontx_ssovf
skeleton librte_pmd_skeleton_event
sw librte_pmd_sw_event
dpaa2 librte_mempool_dpaa2
ring librte_mempool_ring
stack librte_mempool_stack
af_packet librte_pmd_af_packet
ark librte_pmd_ark
avp librte_pmd_avp
bnx2x librte_pmd_bnx2x
bnxt librte_pmd_bnxt
bonding librte_pmd_bond
cxgbe librte_pmd_cxgbe
dpaa2 librte_pmd_dpaa2
e1000 librte_pmd_e1000
ena librte_pmd_ena
enic librte_pmd_enic
failsafe librte_pmd_failsafe
fm10k librte_pmd_fm10k
i40e librte_pmd_i40e
ixgbe librte_pmd_ixgbe
kni librte_pmd_kni
liquidio librte_pmd_lio
mlx4 librte_pmd_mlx4
mlx5 librte_pmd_mlx5
nfp librte_pmd_nfp
null librte_pmd_null
pcap librte_pmd_pcap
qede librte_pmd_qede
ring librte_pmd_ring
sfc librte_pmd_sfc_efx
szedata2 librte_pmd_szedata2
tap librte_pmd_tap
thunderx librte_pmd_thunderx_nicvf
vhost librte_pmd_vhost
virtio librte_pmd_virtio
vmxnet3 librte_pmd_vmxnet3_uio
xenvirt librte_pmd_xenvirt
lib librte_ethtool
eal librte_eal
librte_ether librte_ethdev

If we don't consider the ones where we can add "librte_pmd_", the list is
smaller, but there are still many:

$ git grep "LIB = " | while read line; do dir=$(basename ${line%/Makefile*}); lib=${line#*= }; lib=${lib%*.a}; if [ "$dir" != "$lib" -a "librte_pmd_$dir" != "$lib" ]; then echo "${dir} ${lib}"; fi; done
fslmc librte_bus_fslmc
null librte_pmd_null_crypto
scheduler librte_pmd_crypto_scheduler
dpaa2 librte_pmd_dpaa2_event
octeontx librte_pmd_octeontx_ssovf
skeleton librte_pmd_skeleton_event
sw librte_pmd_sw_event
dpaa2 librte_mempool_dpaa2
ring librte_mempool_ring
stack librte_mempool_stack
bonding librte_pmd_bond
liquidio librte_pmd_lio
sfc librte_pmd_sfc_efx
thunderx librte_pmd_thunderx_nicvf
vmxnet3 librte_pmd_vmxnet3_uio
lib librte_ethtool
eal librte_eal
librte_ether librte_ethdev


To solve this, we can either:

1- do additional fixes of the "dir name -> lib name" conversion in
   lib.mk for all this list above, as we are doing for eal or
   ethdev. This looks feasible, but quite ugly.

2- rename all directories to match the libname (ex: drivers/net/null
   becomes drivers/net/librte_pmd_null). Looks to be a bad idea ;)

3- stop to generate the list of libraries from depdirs: DEPDIRS is
   kept for directory dependency at build, and the list of libraries
   is advertised in LDLIBS variable, in each Makefile.

My vote would go for option 3.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] Inter-PMD dependencies when building shared libraries
  2017-10-05 12:12 ` Olivier MATZ
@ 2017-10-05 12:32   ` Thomas Monjalon
  2017-10-05 12:50     ` Bruce Richardson
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Monjalon @ 2017-10-05 12:32 UTC (permalink / raw)
  To: Olivier MATZ, Eads, Gage
  Cc: dev, 'Jacob, Jerin', santosh.shukla, bruce.richardson

05/10/2017 14:12, Olivier MATZ:
> On Mon, Oct 02, 2017 at 08:48:29PM +0000, Eads, Gage wrote:
> > I believe I've spotted an issue in the way inter-PMD dependencies are handled when building shared libraries. The depdirs_rule in mk/rte.subdir.mk relies on DEPDIRS-xyz containing the names of subdirectories that xyz depends on. In mk/rte.lib.mk, these DEPDIRS are converted into LDLIBS. This works when the subdirectory names match the library names (i.e. any of the libraries under lib/). However when the dependency is on a PMD, the subdirectory and library names don't match.
[...]
> To solve this, we can either:
> 
> 1- do additional fixes of the "dir name -> lib name" conversion in
>    lib.mk for all this list above, as we are doing for eal or
>    ethdev. This looks feasible, but quite ugly.
> 
> 2- rename all directories to match the libname (ex: drivers/net/null
>    becomes drivers/net/librte_pmd_null). Looks to be a bad idea ;)
> 
> 3- stop to generate the list of libraries from depdirs: DEPDIRS is
>    kept for directory dependency at build, and the list of libraries
>    is advertised in LDLIBS variable, in each Makefile.
> 
> My vote would go for option 3.

We could have several libraries in the same directory.
So I vote for option 4:

4- Replace directory dependencies with library dependencies in makefiles.
   And convert libs to dirs with an autogenerated table.

Note: that's why I don't like recursive makefiles like we have
in the DPDK build system. It forces us to deal with directories
instead of just declaring dependencies on real file targets.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] Inter-PMD dependencies when building shared libraries
  2017-10-05 12:32   ` Thomas Monjalon
@ 2017-10-05 12:50     ` Bruce Richardson
  2017-10-12 16:04       ` [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS Olivier Matz
  0 siblings, 1 reply; 11+ messages in thread
From: Bruce Richardson @ 2017-10-05 12:50 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Olivier MATZ, Eads, Gage, dev, 'Jacob, Jerin', santosh.shukla

On Thu, Oct 05, 2017 at 02:32:06PM +0200, Thomas Monjalon wrote:
> 05/10/2017 14:12, Olivier MATZ:
> > On Mon, Oct 02, 2017 at 08:48:29PM +0000, Eads, Gage wrote:
> > > I believe I've spotted an issue in the way inter-PMD dependencies are handled when building shared libraries. The depdirs_rule in mk/rte.subdir.mk relies on DEPDIRS-xyz containing the names of subdirectories that xyz depends on. In mk/rte.lib.mk, these DEPDIRS are converted into LDLIBS. This works when the subdirectory names match the library names (i.e. any of the libraries under lib/). However when the dependency is on a PMD, the subdirectory and library names don't match.
> [...]
> > To solve this, we can either:
> > 
> > 1- do additional fixes of the "dir name -> lib name" conversion in
> >    lib.mk for all this list above, as we are doing for eal or
> >    ethdev. This looks feasible, but quite ugly.
> > 
> > 2- rename all directories to match the libname (ex: drivers/net/null
> >    becomes drivers/net/librte_pmd_null). Looks to be a bad idea ;)
> > 
> > 3- stop to generate the list of libraries from depdirs: DEPDIRS is
> >    kept for directory dependency at build, and the list of libraries
> >    is advertised in LDLIBS variable, in each Makefile.
> > 
> > My vote would go for option 3.
> 
> We could have several libraries in the same directory.
> So I vote for option 4:
> 
> 4- Replace directory dependencies with library dependencies in makefiles.
>    And convert libs to dirs with an autogenerated table.
> 
> Note: that's why I don't like recursive makefiles like we have
> in the DPDK build system. It forces us to deal with directories
> instead of just declaring dependencies on real file targets.

IF we have time to implement your solution 4, then sure. However, if we
want this fixed for 17.11, I think 3 sounds reasonable.

For option 2, renaming directories to standardise things a bit would be
nice, as it would simplify things a bit for the new meson build system -
I could remove the "name" override value for each lib - but I don't
think it would help much in this case without making things extremely
ugly with using full library names as you suggest.

So I think option 3 or 4 is what is needed.

This should not be a problem using meson build, as libs and drivers are
already tracked using dependency objects across build directories.
However, we do need to ensure that our dependencies are always in the
right order, we can't have a NIC pmd driver depending on a mempool
driver, while another mempool driver depends on a different NIC driver.
We need to be able to scan the driver subdirs in a fixed order and have
all dependencies declared before they are needed.

/Bruce

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS
  2017-10-05 12:50     ` Bruce Richardson
@ 2017-10-12 16:04       ` Olivier Matz
  2017-10-12 16:04         ` [dpdk-dev] [PATCH 1/3] crypto/dpaa2_sec: remove uneffective dependency Olivier Matz
                           ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Olivier Matz @ 2017-10-12 16:04 UTC (permalink / raw)
  To: thomas; +Cc: gage.eads, santosh.shukla, bruce.richardson, jerin.jacob, dev

Some libraries in LDLIBS are currently generated from the
DEPDIRS-$(dirname) variables in the Makefiles. This is valid when the
subdirectory name match the library name, but it's not always the case,
especially for PMDs.

This series fixes some invalid dependency declarations first, and
then removes the automatic generation of libraries from the directory
names. Instead, the libraries are explicitly added in each Makefile.

Olivier Matz (3):
  crypto/dpaa2_sec: remove uneffective dependency
  mempool/octeontx: fix dependency
  mk: do not generate LDLIBS from directory dependencies

 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 |  9 ++-------
 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 |  4 +---
 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(+), 80 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH 1/3] crypto/dpaa2_sec: remove uneffective dependency
  2017-10-12 16:04       ` [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS Olivier Matz
@ 2017-10-12 16:04         ` Olivier Matz
  2017-10-12 16:04         ` [dpdk-dev] [PATCH 2/3] mempool/octeontx: fix dependency Olivier Matz
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Olivier Matz @ 2017-10-12 16:04 UTC (permalink / raw)
  To: thomas; +Cc: gage.eads, santosh.shukla, bruce.richardson, jerin.jacob, dev

The syntax "DEPDIRS-y = ..." is deprecated since
commit feb9f680cd2c ("mk: optimize directory dependencies").

Remove this uneffective lines.

The effective dependencies are already declared in
drivers/crypto/Makefile, so there is nothing to add.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 drivers/crypto/dpaa2_sec/Makefile | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/crypto/dpaa2_sec/Makefile b/drivers/crypto/dpaa2_sec/Makefile
index ae15c99fa..be6c94811 100644
--- a/drivers/crypto/dpaa2_sec/Makefile
+++ b/drivers/crypto/dpaa2_sec/Makefile
@@ -71,13 +71,6 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += dpaa2_sec_dpseci.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += mc/dpseci.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += lib/librte_cryptodev
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += drivers/bus/fslmc
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += drivers/mempool/dpaa2
-
 LDLIBS += -lrte_bus_fslmc
 LDLIBS += -lrte_mempool_dpaa2
 
-- 
2.11.0

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH 2/3] mempool/octeontx: fix dependency
  2017-10-12 16:04       ` [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS Olivier Matz
  2017-10-12 16:04         ` [dpdk-dev] [PATCH 1/3] crypto/dpaa2_sec: remove uneffective dependency Olivier Matz
@ 2017-10-12 16:04         ` Olivier Matz
  2017-10-12 16:04         ` [dpdk-dev] [PATCH 3/3] mk: do not generate LDLIBS from directory dependencies Olivier Matz
  2017-10-23 14:39         ` [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS Eads, Gage
  3 siblings, 0 replies; 11+ messages in thread
From: Olivier Matz @ 2017-10-12 16:04 UTC (permalink / raw)
  To: thomas
  Cc: gage.eads, santosh.shukla, bruce.richardson, jerin.jacob, dev, stable

The syntax "DEPDIRS-y = ..." is deprecated since
commit feb9f680cd2c ("mk: optimize directory dependencies").

Replace it with the new style.

Fixes: 8700239f7767 ("mempool/octeontx: add build and log infrastructure")
Cc: stable@dpdk.org

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 drivers/mempool/Makefile          | 2 +-
 drivers/mempool/octeontx/Makefile | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mempool/Makefile b/drivers/mempool/Makefile
index 18cbaa293..435b8fc31 100644
--- a/drivers/mempool/Makefile
+++ b/drivers/mempool/Makefile
@@ -41,6 +41,6 @@ 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_pmd_octeontx_ssovf
+DEPDIRS-octeontx = $(core-libs) librte_mbuf librte_pmd_octeontx_ssovf
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/mempool/octeontx/Makefile b/drivers/mempool/octeontx/Makefile
index 0b2043842..16e215092 100644
--- a/drivers/mempool/octeontx/Makefile
+++ b/drivers/mempool/octeontx/Makefile
@@ -66,9 +66,6 @@ else
 CFLAGS_rte_mempool_octeontx.o += -Ofast
 endif
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_OCTEONTX_MEMPOOL) += lib/librte_mbuf
-
 LDLIBS += -lrte_pmd_octeontx_ssovf
 
 include $(RTE_SDK)/mk/rte.lib.mk
-- 
2.11.0

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [dpdk-dev] [PATCH 3/3] mk: do not generate LDLIBS from directory dependencies
  2017-10-12 16:04       ` [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS Olivier Matz
  2017-10-12 16:04         ` [dpdk-dev] [PATCH 1/3] crypto/dpaa2_sec: remove uneffective dependency Olivier Matz
  2017-10-12 16:04         ` [dpdk-dev] [PATCH 2/3] mempool/octeontx: fix dependency Olivier Matz
@ 2017-10-12 16:04         ` Olivier Matz
  2017-10-24  0:11           ` Thomas Monjalon
  2017-10-23 14:39         ` [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS Eads, Gage
  3 siblings, 1 reply; 11+ messages in thread
From: Olivier Matz @ 2017-10-12 16:04 UTC (permalink / raw)
  To: thomas; +Cc: gage.eads, santosh.shukla, bruce.richardson, jerin.jacob, dev

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@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS
  2017-10-12 16:04       ` [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS Olivier Matz
                           ` (2 preceding siblings ...)
  2017-10-12 16:04         ` [dpdk-dev] [PATCH 3/3] mk: do not generate LDLIBS from directory dependencies Olivier Matz
@ 2017-10-23 14:39         ` Eads, Gage
  2017-10-24  0:15           ` Thomas Monjalon
  3 siblings, 1 reply; 11+ messages in thread
From: Eads, Gage @ 2017-10-23 14:39 UTC (permalink / raw)
  To: Olivier Matz, thomas; +Cc: santosh.shukla, Richardson, Bruce, jerin.jacob, dev



> -----Original Message-----
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> Sent: Thursday, October 12, 2017 11:04 AM
> To: thomas@monjalon.net
> Cc: Eads, Gage <gage.eads@intel.com>; santosh.shukla@caviumnetworks.com;
> Richardson, Bruce <bruce.richardson@intel.com>;
> jerin.jacob@caviumnetworks.com; dev@dpdk.org
> Subject: [PATCH 0/3] mk: fix LDLIBS
> 
> Some libraries in LDLIBS are currently generated from the
> DEPDIRS-$(dirname) variables in the Makefiles. This is valid when the
> subdirectory name match the library name, but it's not always the case,
> especially for PMDs.
> 
> This series fixes some invalid dependency declarations first, and then removes
> the automatic generation of libraries from the directory names. Instead, the
> libraries are explicitly added in each Makefile.
> 

These three patches look good. I tested it on the contrived example from my original email, and this appears to fix the issue.

Once the third patch's apply issues are resolved (http://dpdk.org/ml/archives/test-report/2017-October/032631.html):
Reviewed-by: Gage Eads <gage.eads@intel.com>

Thanks,
Gage

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH 3/3] mk: do not generate LDLIBS from directory dependencies
  2017-10-12 16:04         ` [dpdk-dev] [PATCH 3/3] mk: do not generate LDLIBS from directory dependencies Olivier Matz
@ 2017-10-24  0:11           ` Thomas Monjalon
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Monjalon @ 2017-10-24  0:11 UTC (permalink / raw)
  To: Olivier Matz
  Cc: dev, gage.eads, santosh.shukla, bruce.richardson, jerin.jacob

12/10/2017 18:04, Olivier Matz:
> 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 are defined in conditionals.
The same conditionals must be used for LDLIBS.
See 2 fixes below:

> --- 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

+LDLIBS += -lrte_ip_frag -lrte_sched
+ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
+LDLIBS += -lrte_kni
+endif

> --- 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

+LDLIBS += -lrte_lpm -lrte_hash
+ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
+LDLIBS += -lrte_acl
+endif

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS
  2017-10-23 14:39         ` [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS Eads, Gage
@ 2017-10-24  0:15           ` Thomas Monjalon
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Monjalon @ 2017-10-24  0:15 UTC (permalink / raw)
  To: Olivier Matz
  Cc: dev, Eads, Gage, santosh.shukla, Richardson, Bruce, jerin.jacob

23/10/2017 16:39, Eads, Gage:
> From: Olivier Matz [mailto:olivier.matz@6wind.com]
> > 
> > Some libraries in LDLIBS are currently generated from the
> > DEPDIRS-$(dirname) variables in the Makefiles. This is valid when the
> > subdirectory name match the library name, but it's not always the case,
> > especially for PMDs.
> > 
> > This series fixes some invalid dependency declarations first, and then removes
> > the automatic generation of libraries from the directory names. Instead, the
> > libraries are explicitly added in each Makefile.
> 
> These three patches look good. I tested it on the contrived example from my original email, and this appears to fix the issue.
> 
> Once the third patch's apply issues are resolved (http://dpdk.org/ml/archives/test-report/2017-October/032631.html):
> Reviewed-by: Gage Eads <gage.eads@intel.com>

Fixed some conflicts due to new PMDs and octeontx dependencies changes.
Fixed some misses in patch 3 as explained in prior message.

Applied with some fixes, thanks

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-10-24  0:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-02 20:48 [dpdk-dev] Inter-PMD dependencies when building shared libraries Eads, Gage
2017-10-05 12:12 ` Olivier MATZ
2017-10-05 12:32   ` Thomas Monjalon
2017-10-05 12:50     ` Bruce Richardson
2017-10-12 16:04       ` [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS Olivier Matz
2017-10-12 16:04         ` [dpdk-dev] [PATCH 1/3] crypto/dpaa2_sec: remove uneffective dependency Olivier Matz
2017-10-12 16:04         ` [dpdk-dev] [PATCH 2/3] mempool/octeontx: fix dependency Olivier Matz
2017-10-12 16:04         ` [dpdk-dev] [PATCH 3/3] mk: do not generate LDLIBS from directory dependencies Olivier Matz
2017-10-24  0:11           ` Thomas Monjalon
2017-10-23 14:39         ` [dpdk-dev] [PATCH 0/3] mk: fix LDLIBS Eads, Gage
2017-10-24  0:15           ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).