DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mk: parallelize make config
@ 2017-01-22  1:50 Ferruh Yigit
  2017-01-23 17:18 ` Olivier Matz
                   ` (4 more replies)
  0 siblings, 5 replies; 38+ messages in thread
From: Ferruh Yigit @ 2017-01-22  1:50 UTC (permalink / raw)
  To: dev, Thomas Monjalon; +Cc: Ferruh Yigit

make config dependency resolving was always running serial,
parallelize it for better performance.

$ time make T=x86_64-native-linuxapp-gcc config
real    0m12.633s

$ time make -j8 T=x86_64-native-linuxapp-gcc config
real    0m1.826s

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 mk/internal/rte.depdirs-post.mk | 11 ++++++-----
 mk/rte.sdkdepdirs.mk            | 21 ++++++++++++---------
 mk/rte.subdir.mk                | 15 +++++++--------
 3 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/mk/internal/rte.depdirs-post.mk b/mk/internal/rte.depdirs-post.mk
index 102a369..eb73ad3 100644
--- a/mk/internal/rte.depdirs-post.mk
+++ b/mk/internal/rte.depdirs-post.mk
@@ -29,11 +29,12 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-.PHONY: depdirs
-depdirs:
-	@for d in $(DEPDIRS-y); do \
-		$(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $$d ; \
-	done
+.PHONY: depdirs $(DEPDIRS-y)
+depdirs: $(DEPDIRS-y)
+	@echo ""
+
+$(DEPDIRS-y):
+	@$(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $@
 
 .PHONY: depgraph
 depgraph:
diff --git a/mk/rte.sdkdepdirs.mk b/mk/rte.sdkdepdirs.mk
index bebaf2a..daf42eb 100644
--- a/mk/rte.sdkdepdirs.mk
+++ b/mk/rte.sdkdepdirs.mk
@@ -36,19 +36,22 @@ ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile))
   $(error "need a make config first")
 endif
 
+DEPDIRS = $(addsuffix /.depdirs, $(addprefix $(BUILDDIR)/,$(ROOTDIRS-y)))
+
 # use a "for" in a shell to process dependencies: we don't want this
 # task to be run in parallel.
 .PHONY: depdirs
 depdirs: $(RTE_OUTPUT)/.depdirs
-$(RTE_OUTPUT)/.depdirs: $(RTE_OUTPUT)/.config
-	@rm -f $(RTE_OUTPUT)/.depdirs ; \
-	for d in $(ROOTDIRS-y); do \
-		if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \
-			[ -d $(BUILDDIR)/$$d ] || mkdir -p $(BUILDDIR)/$$d ; \
-			$(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depdirs \
-				>> $(RTE_OUTPUT)/.depdirs ; \
-		fi ; \
-	done
+$(RTE_OUTPUT)/.depdirs: $(DEPDIRS)
+	@rm -f $@
+	@for f in $(DEPDIRS); do cat $$f >> $@; done
+	@sort -u -o $@ $@
+
+$(DEPDIRS): $(RTE_OUTPUT)/.config
+	@f=$(lastword $(subst /, ,$(dir $@))); \
+	[ -d $(BUILDDIR)/$$f ] || mkdir -p $(BUILDDIR)/$$f; \
+	rm -f $@; \
+	$(MAKE) S=$$f -f $(RTE_SRCDIR)/$$f/Makefile depdirs >> $@
 
 .PHONY: depgraph
 depgraph:
diff --git a/mk/rte.subdir.mk b/mk/rte.subdir.mk
index 256e64e..3bb3019 100644
--- a/mk/rte.subdir.mk
+++ b/mk/rte.subdir.mk
@@ -76,7 +76,7 @@ clean: _postclean
 # include .depdirs and define rules to order priorities between build
 # of directories.
 #
-include $(RTE_OUTPUT)/.depdirs
+-include $(RTE_OUTPUT)/.depdirs
 
 define depdirs_rule
 $(1): $(sort $(patsubst $(S)/%,%,$(LOCAL_DEPDIRS-$(S)/$(1))))
@@ -84,16 +84,15 @@ endef
 
 $(foreach d,$(DIRS-y),$(eval $(call depdirs_rule,$(d))))
 
+DEPDIRS = $(wildcard $(addprefix $(S)/,$(DIRS-y)))
 
 # use a "for" in a shell to process dependencies: we don't want this
 # task to be run in parallel.
-.PHONY: depdirs
-depdirs:
-	@for d in $(DIRS-y); do \
-		if [ -f $(SRCDIR)/$$d/Makefile ]; then \
-			$(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depdirs ; \
-		fi ; \
-	done
+.PHONY: depdirs $(DEPDIRS)
+depdirs: $(DEPDIRS)
+
+$(DEPDIRS):
+	@$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile depdirs
 
 .PHONY: depgraph
 depgraph:
-- 
2.9.3

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

* Re: [dpdk-dev] [PATCH] mk: parallelize make config
  2017-01-22  1:50 [dpdk-dev] [PATCH] mk: parallelize make config Ferruh Yigit
@ 2017-01-23 17:18 ` Olivier Matz
  2017-01-23 17:19   ` [dpdk-dev] [PATCH] mk: optimize directory dependencies Olivier Matz
  2017-01-23 17:50   ` [dpdk-dev] [PATCH] mk: parallelize make config Wiles, Keith
  2017-01-23 19:03 ` Michał Mirosław
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 38+ messages in thread
From: Olivier Matz @ 2017-01-23 17:18 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Thomas Monjalon

Hi Ferruh,

On Sun, 22 Jan 2017 01:50:34 +0000, Ferruh Yigit
<ferruh.yigit@intel.com> wrote:
> make config dependency resolving was always running serial,
> parallelize it for better performance.
> 
> $ time make T=x86_64-native-linuxapp-gcc config
> real    0m12.633s
> 
> $ time make -j8 T=x86_64-native-linuxapp-gcc config
> real    0m1.826s
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

I have a patch that fix the same issue (configuration takes to long),
but done differently. It is more intrusive, since it rework the way
DEPDIRS are used, but it does not require to use -j.

I'm sending it as a reply to this thread.

Regards,
Olivier

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

* [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-23 17:18 ` Olivier Matz
@ 2017-01-23 17:19   ` Olivier Matz
  2017-01-24 11:19     ` Robin Jarry
                       ` (3 more replies)
  2017-01-23 17:50   ` [dpdk-dev] [PATCH] mk: parallelize make config Wiles, Keith
  1 sibling, 4 replies; 38+ messages in thread
From: Olivier Matz @ 2017-01-23 17:19 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, thomas.monjalon

Before this patch, the management of dependencies between directories
had several issues:

- the generation of .depdirs, done at configuration is slow: it can take
  more than one minute on some slow targets (usually ~10s on a standard
  PC).

- for instance, it is possible to expressed a dependency like:
  - app/foo depends on lib/librte_foo
  - and lib/librte_foo depends on app/bar
  But this won't work because the directories are traversed with a
  depth-first algorithm, so we have to choose between doing 'app' before
  or after 'lib'.

- the script depdirs-rule.sh is too complex.

- we cannot use "make -d" for debug, because the output of make is used for
  the generation of .depdirs.

This patch moves the DEPDIRS-* variables in the upper Makefile, making
the dependencies much easier to calculate. A DEPDIRS variable is still
used to process library dependencies in LDLIBS.

After this commit, "make config" is almost immediate.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 MAINTAINERS                                      |  1 -
 app/cmdline_test/Makefile                        |  3 -
 app/pdump/Makefile                               |  1 -
 app/proc_info/Makefile                           |  3 -
 app/test-acl/Makefile                            |  1 -
 app/test-pipeline/Makefile                       |  3 -
 app/test-pmd/Makefile                            |  1 -
 app/test/Makefile                                |  3 -
 buildtools/depdirs-rule.sh                       | 95 ------------------------
 buildtools/pmdinfogen/Makefile                   |  2 -
 doc/guides/prog_guide/dev_kit_build_system.rst   |  2 +-
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 28 -------
 drivers/crypto/Makefile                          | 12 +++
 drivers/crypto/aesni_gcm/Makefile                |  7 --
 drivers/crypto/aesni_mb/Makefile                 |  7 --
 drivers/crypto/armv8/Makefile                    |  7 --
 drivers/crypto/kasumi/Makefile                   |  7 --
 drivers/crypto/null/Makefile                     |  7 --
 drivers/crypto/openssl/Makefile                  |  7 --
 drivers/crypto/qat/Makefile                      |  7 --
 drivers/crypto/snow3g/Makefile                   |  7 --
 drivers/crypto/zuc/Makefile                      |  7 --
 drivers/net/Makefile                             | 31 ++++++++
 drivers/net/af_packet/Makefile                   |  7 --
 drivers/net/bnx2x/Makefile                       |  4 -
 drivers/net/bnxt/Makefile                        |  6 --
 drivers/net/bonding/Makefile                     |  9 ---
 drivers/net/cxgbe/Makefile                       |  5 --
 drivers/net/e1000/Makefile                       |  5 --
 drivers/net/ena/Makefile                         |  5 --
 drivers/net/enic/Makefile                        |  6 --
 drivers/net/fm10k/Makefile                       |  6 --
 drivers/net/i40e/Makefile                        |  7 --
 drivers/net/ixgbe/Makefile                       |  6 --
 drivers/net/mlx4/Makefile                        |  6 --
 drivers/net/mlx5/Makefile                        |  7 --
 drivers/net/mpipe/Makefile                       |  3 -
 drivers/net/nfp/Makefile                         |  5 --
 drivers/net/null/Makefile                        |  7 --
 drivers/net/pcap/Makefile                        |  7 --
 drivers/net/qede/Makefile                        |  5 --
 drivers/net/ring/Makefile                        |  5 --
 drivers/net/sfc/Makefile                         |  9 ---
 drivers/net/szedata2/Makefile                    |  7 --
 drivers/net/tap/Makefile                         |  7 --
 drivers/net/thunderx/Makefile                    |  4 -
 drivers/net/vhost/Makefile                       |  8 --
 drivers/net/virtio/Makefile                      |  6 --
 drivers/net/vmxnet3/Makefile                     |  5 --
 drivers/net/xenvirt/Makefile                     |  6 --
 examples/ethtool/Makefile                        |  3 +
 examples/ethtool/lib/Makefile                    |  4 -
 lib/Makefile                                     | 35 +++++++++
 lib/librte_acl/Makefile                          |  3 -
 lib/librte_cfgfile/Makefile                      |  3 -
 lib/librte_cmdline/Makefile                      |  3 -
 lib/librte_cryptodev/Makefile                    |  7 --
 lib/librte_distributor/Makefile                  |  4 -
 lib/librte_eal/Makefile                          |  3 +
 lib/librte_eal/bsdapp/eal/Makefile               |  3 -
 lib/librte_eal/linuxapp/Makefile                 |  3 +
 lib/librte_eal/linuxapp/eal/Makefile             |  3 -
 lib/librte_eal/linuxapp/kni/Makefile             |  3 -
 lib/librte_eal/linuxapp/xen_dom0/Makefile        |  3 -
 lib/librte_efd/Makefile                          |  5 --
 lib/librte_ether/Makefile                        |  3 -
 lib/librte_hash/Makefile                         |  3 -
 lib/librte_ip_frag/Makefile                      |  6 --
 lib/librte_jobstats/Makefile                     |  3 -
 lib/librte_kni/Makefile                          |  5 --
 lib/librte_kvargs/Makefile                       |  3 -
 lib/librte_lpm/Makefile                          |  3 -
 lib/librte_mbuf/Makefile                         |  3 -
 lib/librte_mempool/Makefile                      |  2 -
 lib/librte_meter/Makefile                        |  3 -
 lib/librte_net/Makefile                          |  2 -
 lib/librte_pdump/Makefile                        |  6 --
 lib/librte_pipeline/Makefile                     |  7 --
 lib/librte_port/Makefile                         | 11 ---
 lib/librte_power/Makefile                        |  3 -
 lib/librte_reorder/Makefile                      |  5 --
 lib/librte_ring/Makefile                         |  2 -
 lib/librte_sched/Makefile                        |  5 --
 lib/librte_table/Makefile                        | 11 ---
 lib/librte_timer/Makefile                        |  3 -
 lib/librte_vhost/Makefile                        |  7 --
 mk/internal/rte.depdirs-post.mk                  | 42 -----------
 mk/internal/rte.depdirs-pre.mk                   | 32 --------
 mk/rte.app.mk                                    |  2 -
 mk/rte.bsdmodule.mk                              |  2 -
 mk/rte.extsubdir.mk                              | 14 ++++
 mk/rte.gnuconfigure.mk                           |  2 -
 mk/rte.hostapp.mk                                |  2 -
 mk/rte.hostlib.mk                                |  2 -
 mk/rte.install.mk                                |  2 -
 mk/rte.lib.mk                                    |  8 +-
 mk/rte.module.mk                                 |  2 -
 mk/rte.obj.mk                                    |  2 -
 mk/rte.sdkbuild.mk                               | 19 ++---
 mk/rte.sdkconfig.mk                              |  2 -
 mk/rte.sdkdepdirs.mk                             | 27 -------
 mk/rte.sdkroot.mk                                |  4 -
 mk/rte.shared.mk                                 |  2 -
 mk/rte.subdir.mk                                 | 42 +++--------
 104 files changed, 122 insertions(+), 679 deletions(-)
 delete mode 100755 buildtools/depdirs-rule.sh
 delete mode 100644 mk/internal/rte.depdirs-post.mk
 delete mode 100644 mk/internal/rte.depdirs-pre.mk

diff --git a/MAINTAINERS b/MAINTAINERS
index f071138..56b4efb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -57,7 +57,6 @@ F: config/
 F: mk/
 F: pkg/
 F: buildtools/auto-config-h.sh
-F: buildtools/depdirs-rule.sh
 F: buildtools/gen-build-mk.sh
 F: buildtools/gen-config-h.sh
 F: buildtools/relpath.sh
diff --git a/app/cmdline_test/Makefile b/app/cmdline_test/Makefile
index c6169f5..e9eafd2 100644
--- a/app/cmdline_test/Makefile
+++ b/app/cmdline_test/Makefile
@@ -47,9 +47,6 @@ SRCS-y += commands.c
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
-# this application needs libraries first
-DEPDIRS-y += lib drivers
-
 include $(RTE_SDK)/mk/rte.app.mk
 
 endif
diff --git a/app/pdump/Makefile b/app/pdump/Makefile
index 536198f..8ec6bd6 100644
--- a/app/pdump/Makefile
+++ b/app/pdump/Makefile
@@ -42,7 +42,6 @@ CFLAGS += $(WERROR_FLAGS)
 SRCS-y := main.c
 
 # this application needs libraries first
-DEPDIRS-y += lib
 
 include $(RTE_SDK)/mk/rte.app.mk
 
diff --git a/app/proc_info/Makefile b/app/proc_info/Makefile
index e051e03..9e90438 100644
--- a/app/proc_info/Makefile
+++ b/app/proc_info/Makefile
@@ -39,7 +39,4 @@ CFLAGS += $(WERROR_FLAGS)
 
 SRCS-y := main.c
 
-# this application needs libraries first
-DEPDIRS-y += lib
-
 include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-acl/Makefile b/app/test-acl/Makefile
index 43dfdcb..899a287 100644
--- a/app/test-acl/Makefile
+++ b/app/test-acl/Makefile
@@ -41,7 +41,6 @@ CFLAGS += $(WERROR_FLAGS)
 SRCS-y := main.c
 
 # this application needs libraries first
-DEPDIRS-y += lib
 
 include $(RTE_SDK)/mk/rte.app.mk
 
diff --git a/app/test-pipeline/Makefile b/app/test-pipeline/Makefile
index 4bab6dc..520a319 100644
--- a/app/test-pipeline/Makefile
+++ b/app/test-pipeline/Makefile
@@ -56,9 +56,6 @@ SRCS-y += pipeline_lpm_ipv6.c
 # include ACL lib if available
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += pipeline_acl.c
 
-# this application needs libraries first
-DEPDIRS-y += lib drivers
-
 include $(RTE_SDK)/mk/rte.app.mk
 
 endif
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index a1500bb..a0c72d1 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -67,7 +67,6 @@ endif
 CFLAGS_cmdline.o := -D_GNU_SOURCE
 
 # this application needs libraries first
-DEPDIRS-y += lib drivers
 
 include $(RTE_SDK)/mk/rte.app.mk
 
diff --git a/app/test/Makefile b/app/test/Makefile
index 9de301f..2197bdd 100644
--- a/app/test/Makefile
+++ b/app/test/Makefile
@@ -217,9 +217,6 @@ CFLAGS_test_memcpy_perf.o += -fno-var-tracking-assignments
 endif
 endif
 
-# this application needs libraries first
-DEPDIRS-y += lib drivers
-
 # Link against shared libraries when needed
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
 ifneq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
diff --git a/buildtools/depdirs-rule.sh b/buildtools/depdirs-rule.sh
deleted file mode 100755
index 7aba088..0000000
--- a/buildtools/depdirs-rule.sh
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/sh
-
-#   BSD LICENSE
-#
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   All rights reserved.
-#
-#   Redistribution and use in source and binary forms, with or without
-#   modification, are permitted provided that the following conditions
-#   are met:
-#
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in
-#       the documentation and/or other materials provided with the
-#       distribution.
-#     * Neither the name of Intel Corporation nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
-#
-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#
-# This (obscure) bash script finds the smallest different path between
-# path1 and path2 given as command line argument. The given paths MUST
-# be relative paths, the script is not designed to work with absolute
-# paths.
-#
-# The script will then generate Makefile code that can be saved in a
-# file and included in build system.
-#
-# For instance:
-#   depdirs-rule.sh a/b/c/d a/b/e/f
-# Will print:
-#   FULL_DEPDIRS-a/b/c/d += a/b/e/f
-#   LOCAL_DEPDIRS-a/b/c += a/b/e
-#
-# The script returns 0 except if invalid arguments are given.
-#
-
-if [ $# -ne 2 ]; then
-	echo "Bad arguments"
-	echo "Usage:"
-	echo "  $0 path1 path2"
-	exit 1
-fi
-
-left1=${1%%/*}
-right1=${1#*/}
-prev_right1=$1
-prev_left1=
-
-left2=${2%%/*}
-right2=${2#*/}
-prev_right2=$2
-prev_left2=
-
-while [ "${right1}" != "" -a "${right2}" != "" ]; do
-
-	if [ "$left1" != "$left2" ]; then
-		break
-	fi
-
-	prev_left1=$left1
-	left1=$left1/${right1%%/*}
-	prev_right1=$right1
-	right1=${prev_right1#*/}
-	if [ "$right1" = "$prev_right1" ]; then
-		right1=""
-	fi
-
-	prev_left2=$left2
-	left2=$left2/${right2%%/*}
-	prev_right2=$right2
-	right2=${prev_right2#*/}
-	if [ "$right2" = "$prev_right2" ]; then
-		right2=""
-	fi
-done
-
-echo FULL_DEPDIRS-$1 += $2
-echo LOCAL_DEPDIRS-$left1 += $left2
-
-exit 0
diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bd8f900..bf07b6f 100644
--- a/buildtools/pmdinfogen/Makefile
+++ b/buildtools/pmdinfogen/Makefile
@@ -44,6 +44,4 @@ SRCS-y += pmdinfogen.c
 HOST_CFLAGS += $(WERROR_FLAGS) -g
 HOST_CFLAGS += -I$(RTE_OUTPUT)/include
 
-DEPDIRS-y += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.hostapp.mk
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst b/doc/guides/prog_guide/dev_kit_build_system.rst
index 19de156..ad032c5 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -367,7 +367,7 @@ Variables that Can be Set/Overridden in a Makefile Only
 
 *   POSTCLEAN: A list of actions to be taken after cleaning. The user should use += to append data in this variable.
 
-*   DEPDIR-y: Only used in the development kit framework to specify if the build of the current directory depends on build of another one.
+*   DEPDIRS-$(DIR): Only used in the development kit framework to specify if the build of the current directory depends on build of another one.
     This is needed to support parallel builds correctly.
 
 Variables that can be Set/Overridden by the User on the Command Line Only
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index fb3520e..d7c4106 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -152,34 +152,6 @@ Documentation Targets
 
     Generate the guides documentation in pdf.
 
-
-Deps Targets
-------------
-
-*   depdirs
-
-    This target is implicitly called by make config.
-    Typically, there is no need for a user to call it,
-    except if DEPDIRS-y variables have been updated in Makefiles.
-    It will generate the file  $(RTE_OUTPUT)/.depdirs.
-
-    Example:
-
-    .. code-block:: console
-
-        make depdirs O=mybuild
-
-*   depgraph
-
-    This command generates a dot graph of dependencies.
-    It can be displayed to debug circular dependency issues, or just to understand the dependencies.
-
-    Example:
-
-    .. code-block:: console
-
-        make depgraph O=mybuild > /tmp/graph.dot && dotty /tmp/ graph.dot
-
 Misc Targets
 ------------
 
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index 77b02cf..6bd0d30 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -41,4 +41,16 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += kasumi
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += zuc
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += null
 
+core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_cryptodev
+
+DEPDIRS-aesni_gcm = $(core-libs)
+DEPDIRS-aesni_mb = $(core-libs)
+DEPDIRS-armv8 = $(core-libs)
+DEPDIRS-openssl = $(core-libs)
+DEPDIRS-qat = $(core-libs)
+DEPDIRS-snow3g = $(core-libs)
+DEPDIRS-kasumi = $(core-libs)
+DEPDIRS-zuc = $(core-libs)
+DEPDIRS-null = $(core-libs)
+
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/crypto/aesni_gcm/Makefile b/drivers/crypto/aesni_gcm/Makefile
index fb17fbf..59a7c6a 100644
--- a/drivers/crypto/aesni_gcm/Makefile
+++ b/drivers/crypto/aesni_gcm/Makefile
@@ -56,11 +56,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm_pmd_ops.c
 # export include files
 SYMLINK-y-include +=
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/aesni_mb/Makefile b/drivers/crypto/aesni_mb/Makefile
index d3994cc..611d412 100644
--- a/drivers/crypto/aesni_mb/Makefile
+++ b/drivers/crypto/aesni_mb/Makefile
@@ -58,11 +58,4 @@ LDLIBS += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/armv8/Makefile b/drivers/crypto/armv8/Makefile
index 2003ec4..1474951 100644
--- a/drivers/crypto/armv8/Makefile
+++ b/drivers/crypto/armv8/Makefile
@@ -62,11 +62,4 @@ LDLIBS += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += rte_armv8_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += rte_armv8_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/kasumi/Makefile b/drivers/crypto/kasumi/Makefile
index 9fb0be8..b47cda0 100644
--- a/drivers/crypto/kasumi/Makefile
+++ b/drivers/crypto/kasumi/Makefile
@@ -59,11 +59,4 @@ LDLIBS += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/null/Makefile b/drivers/crypto/null/Makefile
index c143929..bc2724b 100644
--- a/drivers/crypto/null/Makefile
+++ b/drivers/crypto/null/Makefile
@@ -51,11 +51,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += null_crypto_pmd_ops.c
 # export include files
 SYMLINK-y-include +=
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/openssl/Makefile b/drivers/crypto/openssl/Makefile
index 8c4250c..e5fdfb5 100644
--- a/drivers/crypto/openssl/Makefile
+++ b/drivers/crypto/openssl/Makefile
@@ -50,11 +50,4 @@ LDLIBS += -lcrypto
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += rte_openssl_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += rte_openssl_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile
index 20a70d4..7322ffe 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/crypto/qat/Makefile
@@ -56,11 +56,4 @@ SYMLINK-y-include +=
 # versioning export map
 EXPORT_MAP := rte_pmd_qat_version.map
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += lib/librte_cryptodev
-
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/snow3g/Makefile b/drivers/crypto/snow3g/Makefile
index bea6760..ecee80d 100644
--- a/drivers/crypto/snow3g/Makefile
+++ b/drivers/crypto/snow3g/Makefile
@@ -59,11 +59,4 @@ LDLIBS += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/zuc/Makefile b/drivers/crypto/zuc/Makefile
index b15eb0f..f543b40 100644
--- a/drivers/crypto/zuc/Makefile
+++ b/drivers/crypto/zuc/Makefile
@@ -59,11 +59,4 @@ LDLIBS += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 40fc333..a4bb1b9 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -58,8 +58,39 @@ DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
 DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
 
+core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
+core-libs += librte_net librte_kvargs
+
+DEPDIRS-af_packet = $(core-libs)
+DEPDIRS-bnx2x = $(core-libs)
+DEPDIRS-bonding = $(core-libs) librte_cmdline
+DEPDIRS-cxgbe = $(core-libs)
+DEPDIRS-e1000 = $(core-libs)
+DEPDIRS-ena = $(core-libs)
+DEPDIRS-enic = $(core-libs) librte_hash
+DEPDIRS-fm10k = $(core-libs)
+DEPDIRS-i40e = $(core-libs) librte_hash
+DEPDIRS-ixgbe = $(core-libs) librte_hash
+DEPDIRS-mlx4 = $(core-libs)
+DEPDIRS-mlx5 = $(core-libs)
+DEPDIRS-mpipe = $(core-libs)
+DEPDIRS-nfp = $(core-libs)
+DEPDIRS-bnxt = $(core-libs)
+DEPDIRS-null = $(core-libs)
+DEPDIRS-pcap = $(core-libs)
+DEPDIRS-qede = $(core-libs)
+DEPDIRS-ring = $(core-libs)
+DEPDIRS-sfc = $(core-libs)
+DEPDIRS-szedata2 = $(core-libs)
+DEPDIRS-tap = $(core-libs)
+DEPDIRS-thunderx = $(core-libs)
+DEPDIRS-virtio = $(core-libs)
+DEPDIRS-vmxnet3 = $(core-libs)
+DEPDIRS-xenvirt = $(core-libs)
+
 ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += vhost
+DEPDIRS-vhost = $(core-libs) librte_vhost
 endif # $(CONFIG_RTE_LIBRTE_VHOST)
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/net/af_packet/Makefile b/drivers/net/af_packet/Makefile
index e14d6d0..70d517c 100644
--- a/drivers/net/af_packet/Makefile
+++ b/drivers/net/af_packet/Makefile
@@ -50,11 +50,4 @@ CFLAGS += $(WERROR_FLAGS)
 #
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += rte_eth_af_packet.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/bnx2x/Makefile b/drivers/net/bnx2x/Makefile
index e971fb6..e123106 100644
--- a/drivers/net/bnx2x/Makefile
+++ b/drivers/net/bnx2x/Makefile
@@ -29,8 +29,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += ecore_sp.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += elink.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_vfpf.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += lib/librte_mempool lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile
index 65aaa92..0fffe35 100644
--- a/drivers/net/bnxt/Makefile
+++ b/drivers/net/bnxt/Makefile
@@ -66,10 +66,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_irq.c
 #
 SYMLINK-y-include +=
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile
index 504f2e8..910c932 100644
--- a/drivers/net/bonding/Makefile
+++ b/drivers/net/bonding/Makefile
@@ -58,13 +58,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += rte_eth_bond_alb.c
 SYMLINK-y-include += rte_eth_bond.h
 SYMLINK-y-include += rte_eth_bond_8023ad.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_cmdline
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ring
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/cxgbe/Makefile b/drivers/net/cxgbe/Makefile
index bfcc315..7cef627 100644
--- a/drivers/net/cxgbe/Makefile
+++ b/drivers/net/cxgbe/Makefile
@@ -81,9 +81,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += sge.c
 SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += t4_hw.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
index 57a60f0..a32fabe 100644
--- a/drivers/net/e1000/Makefile
+++ b/drivers/net/e1000/Makefile
@@ -96,9 +96,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_IGB_PMD) += igb_pf.c
 SRCS-$(CONFIG_RTE_LIBRTE_EM_PMD) += em_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EM_PMD) += em_rxtx.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/ena/Makefile b/drivers/net/ena/Makefile
index a0d3358..bf1f5da 100644
--- a/drivers/net/ena/Makefile
+++ b/drivers/net/ena/Makefile
@@ -51,11 +51,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena_com.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena_eth_com.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += lib/librte_net
-
 CFLAGS += $(INCLUDES)
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enic/Makefile b/drivers/net/enic/Makefile
index 3926b79..2c7496d 100644
--- a/drivers/net/enic/Makefile
+++ b/drivers/net/enic/Makefile
@@ -63,10 +63,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_intr.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_rq.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_rss.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/fm10k/Makefile b/drivers/net/fm10k/Makefile
index afcbd1d..71d836c 100644
--- a/drivers/net/fm10k/Makefile
+++ b/drivers/net/fm10k/Makefile
@@ -96,10 +96,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k_vf.c
 SRCS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k_api.c
 SRCS-$(CONFIG_RTE_LIBRTE_FM10K_INC_VECTOR) += fm10k_rxtx_vec.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 94482cf..9237f84 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -115,11 +115,4 @@ endif
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include := rte_pmd_i40e.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/ixgbe/Makefile b/drivers/net/ixgbe/Makefile
index 38b9fbd..f62f3d5 100644
--- a/drivers/net/ixgbe/Makefile
+++ b/drivers/net/ixgbe/Makefile
@@ -124,10 +124,4 @@ endif
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)-include := rte_pmd_ixgbe.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/mlx4/Makefile b/drivers/net/mlx4/Makefile
index 68c5902..d30553e 100644
--- a/drivers/net/mlx4/Makefile
+++ b/drivers/net/mlx4/Makefile
@@ -37,12 +37,6 @@ LIB = librte_pmd_mlx4.a
 # Sources.
 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4.c
 
-# Dependencies.
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_mempool
-
 # Basic CFLAGS.
 CFLAGS += -O3
 CFLAGS += -std=gnu99 -Wall -Wextra
diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index 671089c..d18de6b 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -50,13 +50,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_fdir.c
 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_mr.c
 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_flow.c
 
-# Dependencies.
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_kvargs
-
 # Basic CFLAGS.
 CFLAGS += -O3
 CFLAGS += -std=gnu99 -Wall -Wextra
diff --git a/drivers/net/mpipe/Makefile b/drivers/net/mpipe/Makefile
index 846e2e0..f428b33 100644
--- a/drivers/net/mpipe/Makefile
+++ b/drivers/net/mpipe/Makefile
@@ -40,8 +40,5 @@ LIBABIVER := 1
 
 SRCS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += mpipe_tilegx.c
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += lib/librte_net
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/nfp/Makefile b/drivers/net/nfp/Makefile
index 4cadd13..4ee2c2d 100644
--- a/drivers/net/nfp/Makefile
+++ b/drivers/net/nfp/Makefile
@@ -50,9 +50,4 @@ LIBABIVER := 1
 #
 SRCS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp_net.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/null/Makefile b/drivers/net/null/Makefile
index 0c909c6..40a839f 100644
--- a/drivers/net/null/Makefile
+++ b/drivers/net/null/Makefile
@@ -53,11 +53,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += rte_eth_null.c
 #
 SYMLINK-y-include += rte_eth_null.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/pcap/Makefile b/drivers/net/pcap/Makefile
index 89ac402..7ebd0be 100644
--- a/drivers/net/pcap/Makefile
+++ b/drivers/net/pcap/Makefile
@@ -55,11 +55,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += rte_eth_pcap.c
 #
 SYMLINK-y-include +=
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 29b443d..d989536 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -100,9 +100,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_eth_if.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_rxtx.c
 
-# dependent libs:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/ring/Makefile b/drivers/net/ring/Makefile
index ae83505..b7e1a37 100644
--- a/drivers/net/ring/Makefile
+++ b/drivers/net/ring/Makefile
@@ -53,9 +53,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += rte_eth_ring.c
 #
 SYMLINK-y-include += rte_eth_ring.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/sfc/Makefile b/drivers/net/sfc/Makefile
index 14d6536..ad36b9d 100644
--- a/drivers/net/sfc/Makefile
+++ b/drivers/net/sfc/Makefile
@@ -134,13 +134,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += ef10_vpd.c
 SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += hunt_nic.c
 SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += medford_nic.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_mbuf
-
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_TSO) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/szedata2/Makefile b/drivers/net/szedata2/Makefile
index 4a7b14c..836c3b2 100644
--- a/drivers/net/szedata2/Makefile
+++ b/drivers/net/szedata2/Makefile
@@ -54,11 +54,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += rte_eth_szedata2.c
 #
 SYMLINK-y-include +=
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile
index e18f30c..bedd1b7 100644
--- a/drivers/net/tap/Makefile
+++ b/drivers/net/tap/Makefile
@@ -47,11 +47,4 @@ CFLAGS += $(WERROR_FLAGS)
 #
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += rte_eth_tap.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/thunderx/Makefile b/drivers/net/thunderx/Makefile
index bcab5f9..706250b 100644
--- a/drivers/net/thunderx/Makefile
+++ b/drivers/net/thunderx/Makefile
@@ -65,8 +65,4 @@ CFLAGS_nicvf_rxtx.o += -fno-prefetch-loop-arrays
 endif
 CFLAGS_nicvf_rxtx.o += -Ofast
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += lib/librte_mempool lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/vhost/Makefile b/drivers/net/vhost/Makefile
index 050c5aa..3ba8ad6 100644
--- a/drivers/net/vhost/Makefile
+++ b/drivers/net/vhost/Makefile
@@ -55,12 +55,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += rte_eth_vhost.c
 #
 SYMLINK-y-include += rte_eth_vhost.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_vhost
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/virtio/Makefile b/drivers/net/virtio/Makefile
index 8b5b5d6..b21b878 100644
--- a/drivers/net/virtio/Makefile
+++ b/drivers/net/virtio/Makefile
@@ -66,10 +66,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_user/virtio_user_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_user_ethdev.c
 endif
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/vmxnet3/Makefile b/drivers/net/vmxnet3/Makefile
index 23ff1da..84356ae 100644
--- a/drivers/net/vmxnet3/Makefile
+++ b/drivers/net/vmxnet3/Makefile
@@ -76,9 +76,4 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3_ethdev.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/xenvirt/Makefile b/drivers/net/xenvirt/Makefile
index 1d05b71..8b4b8f0 100644
--- a/drivers/net/xenvirt/Makefile
+++ b/drivers/net/xenvirt/Makefile
@@ -54,10 +54,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += rte_eth_xenvirt.c rte_mempool_gntalloc.
 #
 SYMLINK-y-include += rte_eth_xenvirt.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += lib/librte_cmdline
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/examples/ethtool/Makefile b/examples/ethtool/Makefile
index 995cd25..30b42b7 100644
--- a/examples/ethtool/Makefile
+++ b/examples/ethtool/Makefile
@@ -46,4 +46,7 @@ else
 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 46b1b3a..197c1d6 100644
--- a/examples/ethtool/lib/Makefile
+++ b/examples/ethtool/lib/Makefile
@@ -58,8 +58,4 @@ ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
 LDLIBS += -lrte_pmd_ixgbe
 endif
 
-# internal dependencies
-DEPDIRS-y += lib/librte_eal
-DEPDIRS-y += lib/librte_ether
-
 include $(RTE_SDK)/mk/rte.extlib.mk
diff --git a/lib/Makefile b/lib/Makefile
index 4178325..090f8de 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -60,8 +60,43 @@ DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += librte_pipeline
 DIRS-$(CONFIG_RTE_LIBRTE_REORDER) += librte_reorder
 DIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += librte_pdump
 
+DEPDIRS-librte_ring := librte_eal
+DEPDIRS-librte_mempool := librte_eal librte_ring
+DEPDIRS-librte_mbuf := librte_eal librte_mempool
+DEPDIRS-librte_timer := librte_eal
+DEPDIRS-librte_cfgfile := librte_eal
+DEPDIRS-librte_cmdline := librte_eal
+DEPDIRS-librte_ether := librte_net librte_eal librte_mempool librte_ring
+DEPDIRS-librte_ether += librte_mbuf
+DEPDIRS-librte_cryptodev := librte_eal librte_mempool librte_ring librte_mbuf
+DEPDIRS-librte_cryptodev += librte_kvargs
+DEPDIRS-librte_vhost := librte_eal librte_mempool librte_mbuf librte_ether
+DEPDIRS-librte_hash := librte_eal librte_ring
+DEPDIRS-librte_efd := librte_eal librte_ring librte_hash
+DEPDIRS-librte_lpm := librte_eal
+DEPDIRS-librte_acl := librte_eal
+DEPDIRS-librte_net := librte_mbuf
+DEPDIRS-librte_ip_frag := librte_eal librte_ether librte_hash librte_mbuf
+DEPDIRS-librte_ip_frag += librte_mempool
+DEPDIRS-librte_jobstats := librte_eal
+DEPDIRS-librte_power := librte_eal
+DEPDIRS-librte_meter := librte_eal
+DEPDIRS-librte_sched := librte_eal librte_mempool librte_mbuf librte_net
+DEPDIRS-librte_sched += librte_timer
+DEPDIRS-librte_kvargs := librte_eal
+DEPDIRS-librte_distributor := librte_eal librte_mbuf librte_ether
+DEPDIRS-librte_port := librte_eal librte_mbuf librte_mempool librte_ether
+DEPDIRS-librte_port += librte_ip_frag librte_sched librte_kni
+DEPDIRS-librte_table := librte_eal librte_mbuf librte_mempool librte_port
+DEPDIRS-librte_table += librte_lpm librte_acl librte_hash
+DEPDIRS-librte_pipeline := librte_eal librte_meter librte_mempool librte_table
+DEPDIRS-librte_pipeline += librte_port
+DEPDIRS-librte_reorder := librte_mbuf librte_mempool librte_eal
+DEPDIRS-librte_pdump := librte_eal librte_mbuf librte_mempool librte_ether
+
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
 DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni
+DEPDIRS-librte_kni:= librte_eal librte_mbuf librte_mempool librte_ether
 endif
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index d05be66..e2dacd6 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -92,7 +92,4 @@ endif
 SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include := rte_acl_osdep.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include += rte_acl.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ACL) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_cfgfile/Makefile b/lib/librte_cfgfile/Makefile
index 616aef0..755ef11 100644
--- a/lib/librte_cfgfile/Makefile
+++ b/lib/librte_cfgfile/Makefile
@@ -51,7 +51,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_CFGFILE) += rte_cfgfile.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_CFGFILE)-include += rte_cfgfile.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index 7d2d148..644f68e 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -61,7 +61,4 @@ INCS += cmdline_parse_etheraddr.h cmdline_parse_string.h cmdline_rdline.h
 INCS += cmdline_vt100.h cmdline_socket.h cmdline_cirbuf.h cmdline_parse_portlist.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_CMDLINE)-include := $(INCS)
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index aebf5d9..18f5e8c 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -52,11 +52,4 @@ SYMLINK-y-include += rte_cryptodev_pmd.h
 # versioning export map
 EXPORT_MAP := rte_cryptodev_version.map
 
-# library dependencies
-DEPDIRS-y += lib/librte_eal
-DEPDIRS-y += lib/librte_mempool
-DEPDIRS-y += lib/librte_ring
-DEPDIRS-y += lib/librte_mbuf
-DEPDIRS-y += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_distributor/Makefile b/lib/librte_distributor/Makefile
index 4c9af17..e3a3a79 100644
--- a/lib/librte_distributor/Makefile
+++ b/lib/librte_distributor/Makefile
@@ -47,8 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) := rte_distributor.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)-include := rte_distributor.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_eal/Makefile b/lib/librte_eal/Makefile
index cf11a09..5a6277f 100644
--- a/lib/librte_eal/Makefile
+++ b/lib/librte_eal/Makefile
@@ -35,4 +35,7 @@ DIRS-y += common
 DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += linuxapp
 DIRS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += bsdapp
 
+DEPDIRS-linuxapp := common
+DEPDIRS-bsdapp := common
+
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index cce99f7..16791df 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -111,7 +111,4 @@ INC := rte_interrupts.h
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_BSDAPP)-include/exec-env := \
 	$(addprefix include/exec-env/,$(INC))
 
-DEPDIRS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += lib/librte_eal/common
-DEPDIRS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += lib/librte_eal/common/arch/$(ARCH_DIR)
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_eal/linuxapp/Makefile b/lib/librte_eal/linuxapp/Makefile
index 20d2a91..3a23a8e 100644
--- a/lib/librte_eal/linuxapp/Makefile
+++ b/lib/librte_eal/linuxapp/Makefile
@@ -36,4 +36,7 @@ DIRS-$(CONFIG_RTE_EAL_IGB_UIO) += igb_uio
 DIRS-$(CONFIG_RTE_KNI_KMOD) += kni
 DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += xen_dom0
 
+DEPDIRS-xen_dom0 := eal
+DEPDIRS-kni := eal
+
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index aa874a5..8624ad2 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -131,7 +131,4 @@ INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUXAPP)-include/exec-env := \
 	$(addprefix include/exec-env/,$(INC))
 
-DEPDIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += lib/librte_eal/common
-DEPDIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += lib/librte_eal/common/arch/$(ARCH_DIR)
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_eal/linuxapp/kni/Makefile b/lib/librte_eal/linuxapp/kni/Makefile
index 1e47561..f7358a2 100644
--- a/lib/librte_eal/linuxapp/kni/Makefile
+++ b/lib/librte_eal/linuxapp/kni/Makefile
@@ -53,9 +53,6 @@ UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE $(RTE_KERNELDIR)/include/ge
 MODULE_CFLAGS += -D"UBUNTU_KERNEL_CODE=UBUNTU_KERNEL_VERSION($(UBUNTU_KERNEL_CODE))"
 endif
 
-# this lib needs main eal
-DEPDIRS-y += lib/librte_eal/linuxapp/eal
-
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_eal/linuxapp/xen_dom0/Makefile b/lib/librte_eal/linuxapp/xen_dom0/Makefile
index 9d22fb9..be51a82 100644
--- a/lib/librte_eal/linuxapp/xen_dom0/Makefile
+++ b/lib/librte_eal/linuxapp/xen_dom0/Makefile
@@ -44,9 +44,6 @@ MODULE_CFLAGS += -I$(RTE_OUTPUT)/include
 MODULE_CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h
 MODULE_CFLAGS += -Wall -Werror
 
-# this lib needs main eal
-DEPDIRS-y += lib/librte_eal/linuxapp/eal
-
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_efd/Makefile b/lib/librte_efd/Makefile
index 8848c58..8818f8a 100644
--- a/lib/librte_efd/Makefile
+++ b/lib/librte_efd/Makefile
@@ -49,9 +49,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_EFD) := rte_efd.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_EFD)-include := rte_efd.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_EFD) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_EFD) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_EFD) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile
index 1d095a9..066114b 100644
--- a/lib/librte_ether/Makefile
+++ b/lib/librte_ether/Makefile
@@ -55,7 +55,4 @@ SYMLINK-y-include += rte_dev_info.h
 SYMLINK-y-include += rte_flow.h
 SYMLINK-y-include += rte_flow_driver.h
 
-# this lib depends upon:
-DEPDIRS-y += lib/librte_net lib/librte_eal lib/librte_mempool lib/librte_ring lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_hash/Makefile b/lib/librte_hash/Makefile
index bb1ea99..d856aa2 100644
--- a/lib/librte_hash/Makefile
+++ b/lib/librte_hash/Makefile
@@ -55,7 +55,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_jhash.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_thash.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_fbk_hash.h
 
-# this lib needs eal and ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_HASH) += lib/librte_eal lib/librte_ring
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ip_frag/Makefile b/lib/librte_ip_frag/Makefile
index 43f8b1e..4e693bf 100644
--- a/lib/librte_ip_frag/Makefile
+++ b/lib/librte_ip_frag/Makefile
@@ -52,10 +52,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += ip_frag_internal.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_IP_FRAG)-include += rte_ip_frag.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_hash
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mempool
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_jobstats/Makefile b/lib/librte_jobstats/Makefile
index 136a448..561a067 100644
--- a/lib/librte_jobstats/Makefile
+++ b/lib/librte_jobstats/Makefile
@@ -47,7 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_JOBSTATS) := rte_jobstats.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_JOBSTATS)-include := rte_jobstats.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_kni/Makefile b/lib/librte_kni/Makefile
index 0947446..70f1ca8 100644
--- a/lib/librte_kni/Makefile
+++ b/lib/librte_kni/Makefile
@@ -46,9 +46,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_KNI) := rte_kni.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_KNI)-include := rte_kni.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_ether
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
index 87b09f2..564dd31 100644
--- a/lib/librte_kvargs/Makefile
+++ b/lib/librte_kvargs/Makefile
@@ -49,7 +49,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) := rte_kvargs.c
 INCS := rte_kvargs.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_KVARGS)-include := $(INCS)
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KVARGS) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 3dc549d..32be46b 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -55,7 +55,4 @@ else ifeq ($(CONFIG_RTE_ARCH_PPC_64),y)
 SYMLINK-$(CONFIG_RTE_LIBRTE_LPM)-include += rte_lpm_altivec.h
 endif
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_LPM) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 4ae2e8c..956902a 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -46,7 +46,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MBUF) += lib/librte_eal lib/librte_mempool
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
index 057a6ab..96b6ca2 100644
--- a/lib/librte_mempool/Makefile
+++ b/lib/librte_mempool/Makefile
@@ -48,6 +48,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool_stack.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_MEMPOOL)-include := rte_mempool.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += lib/librte_eal lib/librte_ring
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_meter/Makefile b/lib/librte_meter/Makefile
index f07fced..539bfdd 100644
--- a/lib/librte_meter/Makefile
+++ b/lib/librte_meter/Makefile
@@ -53,7 +53,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_METER) := rte_meter.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_METER)-include := rte_meter.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_METER) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 20cf664..abd5c46 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -45,6 +45,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_NET) += lib/librte_eal lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pdump/Makefile b/lib/librte_pdump/Makefile
index 166441a..1c03bcb 100644
--- a/lib/librte_pdump/Makefile
+++ b/lib/librte_pdump/Makefile
@@ -48,10 +48,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PDUMP) := rte_pdump.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_PDUMP)-include := rte_pdump.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += lib/librte_ether
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pipeline/Makefile b/lib/librte_pipeline/Makefile
index 05d64ff..7a835fd 100644
--- a/lib/librte_pipeline/Makefile
+++ b/lib/librte_pipeline/Makefile
@@ -51,11 +51,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := rte_pipeline.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_table
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_port
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile
index 44fa735..76629a1 100644
--- a/lib/librte_port/Makefile
+++ b/lib/librte_port/Makefile
@@ -77,15 +77,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_kni.h
 endif
 SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_source_sink.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) := lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ip_frag
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_sched
-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_kni
-endif
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index cee95cd..06cd10e 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -47,7 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_POWER)-include := rte_power.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_POWER) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_reorder/Makefile b/lib/librte_reorder/Makefile
index 0d111aa..4e44e72 100644
--- a/lib/librte_reorder/Makefile
+++ b/lib/librte_reorder/Makefile
@@ -47,9 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_REORDER) := rte_reorder.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_REORDER)-include := rte_reorder.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_REORDER) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_REORDER) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_REORDER) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
index 4b1112e..3e2f4b8 100644
--- a/lib/librte_ring/Makefile
+++ b/lib/librte_ring/Makefile
@@ -46,6 +46,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_RING) := rte_ring.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_RING)-include := rte_ring.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_RING) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
index 44cb780..18274e7 100644
--- a/lib/librte_sched/Makefile
+++ b/lib/librte_sched/Makefile
@@ -58,9 +58,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_SCHED) += rte_reciprocal.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h rte_bitmap.h rte_sched_common.h rte_red.h rte_approx.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_reciprocal.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_net lib/librte_timer
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_table/Makefile b/lib/librte_table/Makefile
index c82c769..0d06d36 100644
--- a/lib/librte_table/Makefile
+++ b/lib/librte_table/Makefile
@@ -72,15 +72,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_lru.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_array.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_stub.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) := lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_port
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_lpm
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_acl
-endif
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_timer/Makefile b/lib/librte_timer/Makefile
index 2aabef8..03a1539 100644
--- a/lib/librte_timer/Makefile
+++ b/lib/librte_timer/Makefile
@@ -46,7 +46,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_TIMER) := rte_timer.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_TIMER)-include := rte_timer.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TIMER) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
index 415ffc6..1b224b3 100644
--- a/lib/librte_vhost/Makefile
+++ b/lib/librte_vhost/Makefile
@@ -53,11 +53,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c socket.c vhost.c vhost_user.c \
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_virtio_net.h
 
-# dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/mk/internal/rte.depdirs-post.mk b/mk/internal/rte.depdirs-post.mk
deleted file mode 100644
index 102a369..0000000
--- a/mk/internal/rte.depdirs-post.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-#   BSD LICENSE
-#
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   All rights reserved.
-#
-#   Redistribution and use in source and binary forms, with or without
-#   modification, are permitted provided that the following conditions
-#   are met:
-#
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in
-#       the documentation and/or other materials provided with the
-#       distribution.
-#     * Neither the name of Intel Corporation nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
-#
-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-.PHONY: depdirs
-depdirs:
-	@for d in $(DEPDIRS-y); do \
-		$(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $$d ; \
-	done
-
-.PHONY: depgraph
-depgraph:
-	@for d in $(DEPDIRS-y); do \
-		echo "    \"$(S)\" -> \"$$d\"" ; \
-	done
diff --git a/mk/internal/rte.depdirs-pre.mk b/mk/internal/rte.depdirs-pre.mk
deleted file mode 100644
index 8825db0..0000000
--- a/mk/internal/rte.depdirs-pre.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-#   BSD LICENSE
-#
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   All rights reserved.
-#
-#   Redistribution and use in source and binary forms, with or without
-#   modification, are permitted provided that the following conditions
-#   are met:
-#
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in
-#       the documentation and/or other materials provided with the
-#       distribution.
-#     * Neither the name of Intel Corporation nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
-#
-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# nothing
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index a5daa84..962fb5b 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -34,7 +34,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -279,7 +278,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 ifneq ($(wildcard $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.app.mk),)
 include $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.app.mk
diff --git a/mk/rte.bsdmodule.mk b/mk/rte.bsdmodule.mk
index 86b92ff..6fc137a 100644
--- a/mk/rte.bsdmodule.mk
+++ b/mk/rte.bsdmodule.mk
@@ -43,7 +43,6 @@ else
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # DPDK uses a more up-to-date gcc, so clear the override here.
 unexport CC
@@ -111,7 +110,6 @@ doclean:
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.extsubdir.mk b/mk/rte.extsubdir.mk
index f50f006..3e733d8 100644
--- a/mk/rte.extsubdir.mk
+++ b/mk/rte.extsubdir.mk
@@ -30,6 +30,8 @@
 
 MAKEFLAGS += --no-print-directory
 
+ALL_DEPDIRS := $(patsubst DEPDIRS-%,%,$(filter DEPDIRS-%,$(.VARIABLES)))
+
 # output directory
 O ?= .
 BASE_OUTPUT ?= $(O)
@@ -50,4 +52,16 @@ $(DIRS-y):
 		BASE_OUTPUT=$(BASE_OUTPUT) \
 		CUR_SUBDIR=$(CUR_SUBDIR)/$(@) \
 		S=$(CURDIR)/$(@) \
+		DEPDIRS="$(DEPDIRS-$@)" \
 		$(filter-out $(DIRS-y),$(MAKECMDGOALS))
+
+define depdirs_rule
+$(DEPDIRS-$(1)):
+
+$(1): | $(DEPDIRS-$(1))
+
+$(if $(D),$(info $(1) depends on $(DEPDIRS-$(1))))
+endef
+
+$(foreach dir,$(ALL_DEPDIRS),\
+	$(eval $(call depdirs_rule,$(dir))))
diff --git a/mk/rte.gnuconfigure.mk b/mk/rte.gnuconfigure.mk
index 65b658c..b5c8df0 100644
--- a/mk/rte.gnuconfigure.mk
+++ b/mk/rte.gnuconfigure.mk
@@ -32,7 +32,6 @@
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -68,7 +67,6 @@ doclean:
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk
index 07b391c..5cb4909 100644
--- a/mk/rte.hostapp.mk
+++ b/mk/rte.hostapp.mk
@@ -35,7 +35,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -117,7 +116,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.hostlib.mk b/mk/rte.hostlib.mk
index fe24049..7709cff 100644
--- a/mk/rte.hostlib.mk
+++ b/mk/rte.hostlib.mk
@@ -35,7 +35,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -110,7 +109,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.install.mk b/mk/rte.install.mk
index e7ac4d5..96144fb 100644
--- a/mk/rte.install.mk
+++ b/mk/rte.install.mk
@@ -33,7 +33,6 @@
 
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -55,4 +54,3 @@ doclean:
 
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index 33a5f5a..234d717 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -33,7 +33,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 EXTLIB_BUILD ?= n
 
@@ -79,10 +78,10 @@ endif
 
 # Translate DEPDIRS-y into LDLIBS
 # Ignore (sub)directory dependencies which do not provide an actual library
-_IGNORE_DIRS = lib/librte_eal/% lib/librte_compat
-_DEPDIRS = $(filter-out $(_IGNORE_DIRS),$(DEPDIRS-y))
+_IGNORE_DIRS = librte_eal/% librte_compat
+_DEPDIRS = $(filter-out $(_IGNORE_DIRS),$(DEPDIRS))
 _LDDIRS = $(subst librte_ether,librte_ethdev,$(_DEPDIRS))
-LDLIBS += $(subst lib/lib,-l,$(_LDDIRS))
+LDLIBS += $(subst lib,-l,$(_LDDIRS))
 
 O_TO_A = $(AR) crDs $(LIB) $(OBJS-y)
 O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight
@@ -179,7 +178,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.module.mk b/mk/rte.module.mk
index 53ed4fe..3dd9ac7 100644
--- a/mk/rte.module.mk
+++ b/mk/rte.module.mk
@@ -43,7 +43,6 @@ else
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -108,7 +107,6 @@ doclean:
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.obj.mk b/mk/rte.obj.mk
index 5982227..9336d5f 100644
--- a/mk/rte.obj.mk
+++ b/mk/rte.obj.mk
@@ -33,7 +33,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -106,7 +105,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.sdkbuild.mk b/mk/rte.sdkbuild.mk
index db6b983..6ce6306 100644
--- a/mk/rte.sdkbuild.mk
+++ b/mk/rte.sdkbuild.mk
@@ -38,18 +38,9 @@ else
   include $(RTE_SDK)/mk/rte.vars.mk
 endif
 
-#
-# include .depdirs and define rules to order priorities between build
-# of directories.
-#
--include $(RTE_OUTPUT)/.depdirs
-
-define depdirs_rule
-$(1): $(sort $(LOCAL_DEPDIRS-$(1)))
-endef
-
-$(foreach d,$(ROOTDIRS-y),$(eval $(call depdirs_rule,$(d))))
-drivers: | buildtools
+buildtools: | lib
+drivers: | lib buildtools
+app: | lib buildtools drivers
 
 #
 # build and clean targets
@@ -90,8 +81,8 @@ $(ROOTDIRS-y):
 
 RTE_MAKE_SUBTARGET ?= all
 
-%_sub: $(addsuffix _sub,$(FULL_DEPDIRS-$(*)))
-	@echo $(addsuffix _sub,$(FULL_DEPDIRS-$(*)))
+%_sub: $(addsuffix _sub,$(*))
+	@echo $(addsuffix _sub,$(*))
 	@[ -d $(BUILDDIR)/$* ] || mkdir -p $(BUILDDIR)/$*
 	@echo "== Build $*"
 	$(Q)$(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* \
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index 97581c9..1f2d6bd 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -69,7 +69,6 @@ ifeq ($(RTE_CONFIG_TEMPLATE),)
 config: notemplate
 else
 config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
-	$(Q)$(MAKE) depdirs
 	@echo "Configuration done"
 endif
 
@@ -140,7 +139,6 @@ checkconfig:
 	fi
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk \
 		headerconfig NODOTCONF=1
-	$(Q)$(MAKE) -s depdirs
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.sdkdepdirs.mk b/mk/rte.sdkdepdirs.mk
index bebaf2a..1f27697 100644
--- a/mk/rte.sdkdepdirs.mk
+++ b/mk/rte.sdkdepdirs.mk
@@ -35,30 +35,3 @@ endif
 ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile))
   $(error "need a make config first")
 endif
-
-# use a "for" in a shell to process dependencies: we don't want this
-# task to be run in parallel.
-.PHONY: depdirs
-depdirs: $(RTE_OUTPUT)/.depdirs
-$(RTE_OUTPUT)/.depdirs: $(RTE_OUTPUT)/.config
-	@rm -f $(RTE_OUTPUT)/.depdirs ; \
-	for d in $(ROOTDIRS-y); do \
-		if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \
-			[ -d $(BUILDDIR)/$$d ] || mkdir -p $(BUILDDIR)/$$d ; \
-			$(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depdirs \
-				>> $(RTE_OUTPUT)/.depdirs ; \
-		fi ; \
-	done
-
-.PHONY: depgraph
-depgraph:
-	@echo "digraph unix {" ; \
-	echo "    size=\"6,6\";" ; \
-	echo "    node [color=lightblue2, style=filled];" ; \
-	for d in $(ROOTDIRS-y); do \
-		echo "    \"root\" -> \"$$d\"" ; \
-		if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \
-			$(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depgraph ; \
-		fi ; \
-	done ; \
-	echo "}"
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index 04ad523..ef13682 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -109,10 +109,6 @@ help: doc-help
 doc-%:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkdoc.mk $*
 
-.PHONY: depdirs depgraph
-depdirs depgraph:
-	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkdepdirs.mk $@
-
 .PHONY: gcov gcovclean
 gcov gcovclean:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkgcov.mk $@
diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk
index fc6b0b4..87ccf0b 100644
--- a/mk/rte.shared.mk
+++ b/mk/rte.shared.mk
@@ -32,7 +32,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -131,7 +130,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.subdir.mk b/mk/rte.subdir.mk
index 256e64e..364b80e 100644
--- a/mk/rte.subdir.mk
+++ b/mk/rte.subdir.mk
@@ -37,6 +37,8 @@ include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
 
+ALL_DEPDIRS := $(patsubst DEPDIRS-%,%,$(filter DEPDIRS-%,$(.VARIABLES)))
+
 CLEANDIRS = $(addsuffix _clean,$(DIRS-y) $(DIRS-n) $(DIRS-))
 
 VPATH += $(SRCDIR)
@@ -59,8 +61,9 @@ build: _postbuild
 .PHONY: $(DIRS-y)
 $(DIRS-y):
 	@[ -d $(CURDIR)/$@ ] || mkdir -p $(CURDIR)/$@
-	@echo "== Build $S/$@"
-	@$(MAKE) S=$S/$@ -f $(SRCDIR)/$@/Makefile -C $(CURDIR)/$@ all
+	@echo "== Build $S/$@ "
+	@$(MAKE) S=$S/$@ -f $(SRCDIR)/$@/Makefile -C $(CURDIR)/$@ \
+		DEPDIRS="$(DEPDIRS-$@)" all
 
 .PHONY: clean
 clean: _postclean
@@ -72,37 +75,16 @@ clean: _postclean
 	fi
 	@rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS)
 
-#
-# include .depdirs and define rules to order priorities between build
-# of directories.
-#
-include $(RTE_OUTPUT)/.depdirs
-
 define depdirs_rule
-$(1): $(sort $(patsubst $(S)/%,%,$(LOCAL_DEPDIRS-$(S)/$(1))))
+$(DEPDIRS-$(1)):
+
+$(1): | $(DEPDIRS-$(1))
+
+$(if $(D),$(info $(1) depends on $(DEPDIRS-$(1))))
 endef
 
-$(foreach d,$(DIRS-y),$(eval $(call depdirs_rule,$(d))))
-
-
-# use a "for" in a shell to process dependencies: we don't want this
-# task to be run in parallel.
-.PHONY: depdirs
-depdirs:
-	@for d in $(DIRS-y); do \
-		if [ -f $(SRCDIR)/$$d/Makefile ]; then \
-			$(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depdirs ; \
-		fi ; \
-	done
-
-.PHONY: depgraph
-depgraph:
-	@for d in $(DIRS-y); do \
-		echo "    \"$(S)\" -> \"$(S)/$$d\"" ; \
-		if [ -f $(SRCDIR)/$$d/Makefile ]; then \
-			$(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depgraph ; \
-		fi ; \
-	done
+$(foreach dir,$(ALL_DEPDIRS),\
+	$(eval $(call depdirs_rule,$(dir))))
 
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
-- 
2.8.1

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

* Re: [dpdk-dev] [PATCH] mk: parallelize make config
  2017-01-23 17:18 ` Olivier Matz
  2017-01-23 17:19   ` [dpdk-dev] [PATCH] mk: optimize directory dependencies Olivier Matz
@ 2017-01-23 17:50   ` Wiles, Keith
  2017-01-24  8:42     ` Olivier MATZ
  1 sibling, 1 reply; 38+ messages in thread
From: Wiles, Keith @ 2017-01-23 17:50 UTC (permalink / raw)
  To: Olivier Matz; +Cc: Yigit, Ferruh, dev, Thomas Monjalon


> On Jan 23, 2017, at 10:18 AM, Olivier Matz <olivier.matz@6wind.com> wrote:
> 
> Hi Ferruh,
> 
> On Sun, 22 Jan 2017 01:50:34 +0000, Ferruh Yigit
> <ferruh.yigit@intel.com> wrote:
>> make config dependency resolving was always running serial,
>> parallelize it for better performance.
>> 
>> $ time make T=x86_64-native-linuxapp-gcc config
>> real    0m12.633s
>> 
>> $ time make -j8 T=x86_64-native-linuxapp-gcc config
>> real    0m1.826s
>> 
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 
> I have a patch that fix the same issue (configuration takes to long),
> but done differently. It is more intrusive, since it rework the way
> DEPDIRS are used, but it does not require to use -j.

I tested the patch and the performance is very quick and seems to work very nicely. I have not looked at the other patch yet are they both compatible and could be combined or not?

> 
> I'm sending it as a reply to this thread.
> 
> Regards,
> Olivier

Regards,
Keith

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

* Re: [dpdk-dev] [PATCH] mk: parallelize make config
  2017-01-22  1:50 [dpdk-dev] [PATCH] mk: parallelize make config Ferruh Yigit
  2017-01-23 17:18 ` Olivier Matz
@ 2017-01-23 19:03 ` Michał Mirosław
  2017-01-30  9:41   ` Ferruh Yigit
  2017-01-24 10:52 ` Bruce Richardson
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 38+ messages in thread
From: Michał Mirosław @ 2017-01-23 19:03 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Thomas Monjalon

2017-01-22 2:50 GMT+01:00 Ferruh Yigit <ferruh.yigit@intel.com>:
> make config dependency resolving was always running serial,
> parallelize it for better performance.
>
> $ time make T=x86_64-native-linuxapp-gcc config
> real    0m12.633s
>
> $ time make -j8 T=x86_64-native-linuxapp-gcc config
> real    0m1.826s
[...]
> +$(RTE_OUTPUT)/.depdirs: $(DEPDIRS)
> +       @rm -f $@
> +       @for f in $(DEPDIRS); do cat $$f >> $@; done
> +       @sort -u -o $@ $@

This could be just one 'sort -u -o $@ $(DEPDIRS)'

Best Regards,
Michał Mirosław

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

* Re: [dpdk-dev] [PATCH] mk: parallelize make config
  2017-01-23 17:50   ` [dpdk-dev] [PATCH] mk: parallelize make config Wiles, Keith
@ 2017-01-24  8:42     ` Olivier MATZ
  2017-01-24 10:02       ` Bruce Richardson
  0 siblings, 1 reply; 38+ messages in thread
From: Olivier MATZ @ 2017-01-24  8:42 UTC (permalink / raw)
  To: Wiles, Keith; +Cc: Olivier Matz, Yigit, Ferruh, dev, Thomas Monjalon

Hi Keith,

On Mon, 23 Jan 2017 17:50:27 +0000, "Wiles, Keith"
<keith.wiles@intel.com> wrote:
> > On Jan 23, 2017, at 10:18 AM, Olivier Matz <olivier.matz@6wind.com>
> > wrote:
> > 
> > Hi Ferruh,
> > 
> > On Sun, 22 Jan 2017 01:50:34 +0000, Ferruh Yigit
> > <ferruh.yigit@intel.com> wrote:  
> >> make config dependency resolving was always running serial,
> >> parallelize it for better performance.
> >> 
> >> $ time make T=x86_64-native-linuxapp-gcc config
> >> real    0m12.633s
> >> 
> >> $ time make -j8 T=x86_64-native-linuxapp-gcc config
> >> real    0m1.826s
> >> 
> >> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>  
> > 
> > I have a patch that fix the same issue (configuration takes to
> > long), but done differently. It is more intrusive, since it rework
> > the way DEPDIRS are used, but it does not require to use -j.  
> 
> I tested the patch and the performance is very quick and seems to
> work very nicely. I have not looked at the other patch yet are they
> both compatible and could be combined or not?

No, I don't think they could be combined.

Ferruh's approach looks less risky, since it's a parallelization
of the config. My approach changes the way dependencies are processed,
and also how they are declared. I think it's faster, but more intrusive.

Regards,
Olivier

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

* Re: [dpdk-dev] [PATCH] mk: parallelize make config
  2017-01-24  8:42     ` Olivier MATZ
@ 2017-01-24 10:02       ` Bruce Richardson
  0 siblings, 0 replies; 38+ messages in thread
From: Bruce Richardson @ 2017-01-24 10:02 UTC (permalink / raw)
  To: Olivier MATZ; +Cc: Wiles, Keith, Yigit, Ferruh, dev, Thomas Monjalon

On Tue, Jan 24, 2017 at 09:42:35AM +0100, Olivier MATZ wrote:
> Hi Keith,
> 
> On Mon, 23 Jan 2017 17:50:27 +0000, "Wiles, Keith"
> <keith.wiles@intel.com> wrote:
> > > On Jan 23, 2017, at 10:18 AM, Olivier Matz <olivier.matz@6wind.com>
> > > wrote:
> > > 
> > > Hi Ferruh,
> > > 
> > > On Sun, 22 Jan 2017 01:50:34 +0000, Ferruh Yigit
> > > <ferruh.yigit@intel.com> wrote:  
> > >> make config dependency resolving was always running serial,
> > >> parallelize it for better performance.
> > >> 
> > >> $ time make T=x86_64-native-linuxapp-gcc config
> > >> real    0m12.633s
> > >> 
> > >> $ time make -j8 T=x86_64-native-linuxapp-gcc config
> > >> real    0m1.826s
> > >> 
> > >> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>  
> > > 
> > > I have a patch that fix the same issue (configuration takes to
> > > long), but done differently. It is more intrusive, since it rework
> > > the way DEPDIRS are used, but it does not require to use -j.  
> > 
> > I tested the patch and the performance is very quick and seems to
> > work very nicely. I have not looked at the other patch yet are they
> > both compatible and could be combined or not?
> 
> No, I don't think they could be combined.
> 
> Ferruh's approach looks less risky, since it's a parallelization
> of the config. My approach changes the way dependencies are processed,
> and also how they are declared. I think it's faster, but more intrusive.
>
I think we may hit a case of diminishing returns. On my system, the
config time goes from 12 seconds down to less than 1 second (large
amounts of parallelism). Even with limiting parallelism to just 4
make processes, the time for config drops to 3 seconds.
I don't see huge value in trying to shave off any more time than
that, given the amount of extra complexity involved.

/Bruce

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

* Re: [dpdk-dev] [PATCH] mk: parallelize make config
  2017-01-22  1:50 [dpdk-dev] [PATCH] mk: parallelize make config Ferruh Yigit
  2017-01-23 17:18 ` Olivier Matz
  2017-01-23 19:03 ` Michał Mirosław
@ 2017-01-24 10:52 ` Bruce Richardson
  2017-01-29 15:29 ` Thomas Monjalon
  2017-01-30 10:21 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
  4 siblings, 0 replies; 38+ messages in thread
From: Bruce Richardson @ 2017-01-24 10:52 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Thomas Monjalon

On Sun, Jan 22, 2017 at 01:50:34AM +0000, Ferruh Yigit wrote:
> make config dependency resolving was always running serial,
> parallelize it for better performance.
> 
> $ time make T=x86_64-native-linuxapp-gcc config
> real    0m12.633s
> 
> $ time make -j8 T=x86_64-native-linuxapp-gcc config
> real    0m1.826s
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Works great for me! Config time has always been a pain.

Tested-by: Bruce Richardson <bruce.richardson@intel.com>

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-23 17:19   ` [dpdk-dev] [PATCH] mk: optimize directory dependencies Olivier Matz
@ 2017-01-24 11:19     ` Robin Jarry
  2017-01-24 11:26       ` Bruce Richardson
  2017-01-24 11:40     ` Jerin Jacob
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 38+ messages in thread
From: Robin Jarry @ 2017-01-24 11:19 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, ferruh.yigit, thomas.monjalon

Hi Olivier,

2017-01-23, Olivier Matz:
>Before this patch, the management of dependencies between directories
>had several issues:
>
>- the generation of .depdirs, done at configuration is slow: it can take
>  more than one minute on some slow targets (usually ~10s on a standard
>  PC).

Indeed, on a Qualcomm development board where disk I/O is quite slow:

  $ git describe
  v17.02-rc1-3-g61207d014fc9

  $ time make config T=arm64-armv8a-linuxapp-gcc
  real    1m4.308s

>- for instance, it is possible to expressed a dependency like:

s/expressed/express/

>- we cannot use "make -d" for debug, because the output of make is used 
>for the generation of .depdirs.

That is really annoying when debugging makefiles.

After applying this patch:

  $ git am mk-optimize-directory-dependencies.patch
  Applying: mk: optimize directory dependencies
  $ rm -rf build/

  $ time make config T=arm64-armv8a-linuxapp-gcc
  real    0m0.111s

Almost 600 times faster than before!

I prefer this solution to the one proposed by Ferruh (which is 
interesting but requires to run parallel make). Here is a test with the 
other patch:

  $ git am mk-parallelize-make-config.patch
  Applying: mk: parallelize make config
  $ rm -rf build/
  $ grep -c processor /proc/cpuinfo
  24

  $ time make config T=arm64-armv8a-linuxapp-gcc -j24
  real    0m11.253s

Here only 6 times faster than before, even when using 24 parallel 
processes.

Tested-by: Robin Jarry <robin.jarry@6wind.com>

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-24 11:19     ` Robin Jarry
@ 2017-01-24 11:26       ` Bruce Richardson
  2017-01-24 12:31         ` Robin Jarry
  0 siblings, 1 reply; 38+ messages in thread
From: Bruce Richardson @ 2017-01-24 11:26 UTC (permalink / raw)
  To: Robin Jarry; +Cc: Olivier Matz, dev, ferruh.yigit, thomas.monjalon

On Tue, Jan 24, 2017 at 12:19:49PM +0100, Robin Jarry wrote:
> Hi Olivier,
> 
> 2017-01-23, Olivier Matz:
> > Before this patch, the management of dependencies between directories
> > had several issues:
> > 
> > - the generation of .depdirs, done at configuration is slow: it can take
> >  more than one minute on some slow targets (usually ~10s on a standard
> >  PC).
> 
> Indeed, on a Qualcomm development board where disk I/O is quite slow:
> 
>  $ git describe
>  v17.02-rc1-3-g61207d014fc9
> 
>  $ time make config T=arm64-armv8a-linuxapp-gcc
>  real    1m4.308s
> 

Wow, what is the build time in that case?

> > - for instance, it is possible to expressed a dependency like:
> 
> s/expressed/express/
> 
> > - we cannot use "make -d" for debug, because the output of make is used
> > for the generation of .depdirs.
> 
> That is really annoying when debugging makefiles.
> 
> After applying this patch:
> 
>  $ git am mk-optimize-directory-dependencies.patch
>  Applying: mk: optimize directory dependencies
>  $ rm -rf build/
> 
>  $ time make config T=arm64-armv8a-linuxapp-gcc
>  real    0m0.111s
> 
> Almost 600 times faster than before!
> 
> I prefer this solution to the one proposed by Ferruh (which is interesting
> but requires to run parallel make). Here is a test with the other patch:
> 
>  $ git am mk-parallelize-make-config.patch
>  Applying: mk: parallelize make config
>  $ rm -rf build/
>  $ grep -c processor /proc/cpuinfo
>  24
> 
>  $ time make config T=arm64-armv8a-linuxapp-gcc -j24
>  real    0m11.253s
> 
> Here only 6 times faster than before, even when using 24 parallel processes.
> 
> Tested-by: Robin Jarry <robin.jarry@6wind.com>

Hi Robin,

what are the differences in the patches like when doing a build rather
than just a config? If the build is minutes long because of slow IO,
is the extra 10 seconds really going to make that much of a difference?

Regards,
/Bruce

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-23 17:19   ` [dpdk-dev] [PATCH] mk: optimize directory dependencies Olivier Matz
  2017-01-24 11:19     ` Robin Jarry
@ 2017-01-24 11:40     ` Jerin Jacob
  2017-01-24 12:15       ` Bruce Richardson
  2017-01-24 13:05     ` Ferruh Yigit
  2017-03-17 17:13     ` Olivier Matz
  3 siblings, 1 reply; 38+ messages in thread
From: Jerin Jacob @ 2017-01-24 11:40 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, ferruh.yigit, thomas.monjalon

On Mon, Jan 23, 2017 at 06:19:13PM +0100, Olivier Matz wrote:
> Before this patch, the management of dependencies between directories
> had several issues:
> 
> - the generation of .depdirs, done at configuration is slow: it can take
>   more than one minute on some slow targets (usually ~10s on a standard
>   PC).
> 
> - for instance, it is possible to expressed a dependency like:
>   - app/foo depends on lib/librte_foo
>   - and lib/librte_foo depends on app/bar
>   But this won't work because the directories are traversed with a
>   depth-first algorithm, so we have to choose between doing 'app' before
>   or after 'lib'.
> 
> - the script depdirs-rule.sh is too complex.
> 
> - we cannot use "make -d" for debug, because the output of make is used for
>   the generation of .depdirs.
> 
> This patch moves the DEPDIRS-* variables in the upper Makefile, making
> the dependencies much easier to calculate. A DEPDIRS variable is still
> used to process library dependencies in LDLIBS.
> 
> After this commit, "make config" is almost immediate.
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>

Tested both approach on ThunderX. This patch looks better

Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc 
Configuration done

real    0m18.112s
user    0m2.810s
sys     0m0.660s

➜ [master]GB-2S [dpdk-master] $ pwclient git-am 19859
Applying patch #19859 using 'git am'
Description: [dpdk-dev] mk: parallelize make config
Applying: mk: parallelize make config

➜ [master]GB-2S [dpdk-master] $ rm -rf build
➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 8
Configuration done

real    0m2.812s
user    0m3.020s
sys     0m0.870s

➜ [master]GB-2S [dpdk-master] $ rm -rf build
➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 16
Configuration done

real    0m1.748s
user    0m3.040s
sys     0m1.020s

➜ [master]GB-2S [dpdk-master] $ rm -rf build
➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 32
Configuration done

real    0m1.422s
user    0m3.380s
sys     0m1.080s

➜ [master]GB-2S [dpdk-master] $ pwclient git-am 19918
Applying patch #19918 using 'git am'
Description: [dpdk-dev] mk: optimize directory dependencies
Applying: mk: optimize directory dependencies

➜ [master]GB-2S [dpdk-master] $ rm -rf build
➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc 
Configuration done

real    0m0.064s
user    0m0.000s
sys     0m0.000s
➜ [master]GB-2S [dpdk-master] $ rm -rf build
➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 8
Configuration done

real    0m0.055s
user    0m0.000s
sys     0m0.000s

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-24 11:40     ` Jerin Jacob
@ 2017-01-24 12:15       ` Bruce Richardson
  2017-01-24 12:56         ` Jerin Jacob
  0 siblings, 1 reply; 38+ messages in thread
From: Bruce Richardson @ 2017-01-24 12:15 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: Olivier Matz, dev, ferruh.yigit, thomas.monjalon

On Tue, Jan 24, 2017 at 05:10:15PM +0530, Jerin Jacob wrote:
> On Mon, Jan 23, 2017 at 06:19:13PM +0100, Olivier Matz wrote:
> > Before this patch, the management of dependencies between directories
> > had several issues:
> > 
> > - the generation of .depdirs, done at configuration is slow: it can take
> >   more than one minute on some slow targets (usually ~10s on a standard
> >   PC).
> > 
> > - for instance, it is possible to expressed a dependency like:
> >   - app/foo depends on lib/librte_foo
> >   - and lib/librte_foo depends on app/bar
> >   But this won't work because the directories are traversed with a
> >   depth-first algorithm, so we have to choose between doing 'app' before
> >   or after 'lib'.
> > 
> > - the script depdirs-rule.sh is too complex.
> > 
> > - we cannot use "make -d" for debug, because the output of make is used for
> >   the generation of .depdirs.
> > 
> > This patch moves the DEPDIRS-* variables in the upper Makefile, making
> > the dependencies much easier to calculate. A DEPDIRS variable is still
> > used to process library dependencies in LDLIBS.
> > 
> > After this commit, "make config" is almost immediate.
> > 
> > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Tested both approach on ThunderX. This patch looks better
> 
> Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> 
> ➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc 
> Configuration done
> 
> real    0m18.112s
> user    0m2.810s
> sys     0m0.660s
> 
> ➜ [master]GB-2S [dpdk-master] $ pwclient git-am 19859
> Applying patch #19859 using 'git am'
> Description: [dpdk-dev] mk: parallelize make config
> Applying: mk: parallelize make config
> 
> ➜ [master]GB-2S [dpdk-master] $ rm -rf build
> ➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 8
> Configuration done
> 
> real    0m2.812s
> user    0m3.020s
> sys     0m0.870s
> 
> ➜ [master]GB-2S [dpdk-master] $ rm -rf build
> ➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 16
> Configuration done
> 
> real    0m1.748s
> user    0m3.040s
> sys     0m1.020s
> 
> ➜ [master]GB-2S [dpdk-master] $ rm -rf build
> ➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 32
> Configuration done
> 
> real    0m1.422s
> user    0m3.380s
> sys     0m1.080s
> 
> ➜ [master]GB-2S [dpdk-master] $ pwclient git-am 19918
> Applying patch #19918 using 'git am'
> Description: [dpdk-dev] mk: optimize directory dependencies
> Applying: mk: optimize directory dependencies
> 
> ➜ [master]GB-2S [dpdk-master] $ rm -rf build
> ➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc 
> Configuration done
> 
> real    0m0.064s
> user    0m0.000s
> sys     0m0.000s
> ➜ [master]GB-2S [dpdk-master] $ rm -rf build
> ➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 8
> Configuration done
> 
> real    0m0.055s
> user    0m0.000s
> sys     0m0.000s
>

I agree that Olivier's patch is faster. However, I think I prefer having
the library dependencies in the makefiles for the libs themselves rather
than up a level. Given that we are only looking at ~2second of a
difference here in your tests - assuming -j flag - what is the actual
build time differences? My suspicion is that after Ferruh's simpler
patch is applied, the config time becomes such a small part of the
build, that the extra benefits from Oliviers work is not worth the extra
complexity.

Regards,
/Bruce

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-24 11:26       ` Bruce Richardson
@ 2017-01-24 12:31         ` Robin Jarry
  0 siblings, 0 replies; 38+ messages in thread
From: Robin Jarry @ 2017-01-24 12:31 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: Olivier Matz, dev, ferruh.yigit, thomas.monjalon

Hi Bruce,

2017-01-24, Bruce Richardson:
>what are the differences in the patches like when doing a build rather
>than just a config? If the build is minutes long because of slow IO,
>is the extra 10 seconds really going to make that much of a difference?

I agree there is no significant difference in total build time (config 
included) when using -j8 (about ~15s). And I understand your concern 
about the complexity of the patch in the second solution.

But the way dependencies are computed is overly complex and I feel that 
parallelizing is just hiding dust under the carpet. The result after the 
second solution is cleaner (to me): we get rid of an obscure shell 
script and we stop piping make output to files thus restoring the 
possibility to use make -d to debug problems.

And while the goal is to reduce the config time, why not go all the 
way?

-- 
Robin

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-24 12:15       ` Bruce Richardson
@ 2017-01-24 12:56         ` Jerin Jacob
  2017-01-24 13:26           ` Richardson, Bruce
  0 siblings, 1 reply; 38+ messages in thread
From: Jerin Jacob @ 2017-01-24 12:56 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: Olivier Matz, dev, ferruh.yigit, thomas.monjalon

On Tue, Jan 24, 2017 at 12:15:06PM +0000, Bruce Richardson wrote:
> On Tue, Jan 24, 2017 at 05:10:15PM +0530, Jerin Jacob wrote:
> > On Mon, Jan 23, 2017 at 06:19:13PM +0100, Olivier Matz wrote:
> > > Before this patch, the management of dependencies between directories
> > > had several issues:
> > > 
> > > - the generation of .depdirs, done at configuration is slow: it can take
> > >   more than one minute on some slow targets (usually ~10s on a standard
> > >   PC).
> > > 
> > > - for instance, it is possible to expressed a dependency like:
> > >   - app/foo depends on lib/librte_foo
> > >   - and lib/librte_foo depends on app/bar
> > >   But this won't work because the directories are traversed with a
> > >   depth-first algorithm, so we have to choose between doing 'app' before
> > >   or after 'lib'.
> > > 
> > > - the script depdirs-rule.sh is too complex.
> > > 
> > > - we cannot use "make -d" for debug, because the output of make is used for
> > >   the generation of .depdirs.
> > > 
> > > This patch moves the DEPDIRS-* variables in the upper Makefile, making
> > > the dependencies much easier to calculate. A DEPDIRS variable is still
> > > used to process library dependencies in LDLIBS.
> > > 
> > > After this commit, "make config" is almost immediate.
> > > 
> > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> > 
> > Tested both approach on ThunderX. This patch looks better
> > 
> > Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > 
> > ➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc 
> > Configuration done
> > 
> > real    0m18.112s
> > user    0m2.810s
> > sys     0m0.660s
> > 
> > ➜ [master]GB-2S [dpdk-master] $ pwclient git-am 19859
> > Applying patch #19859 using 'git am'
> > Description: [dpdk-dev] mk: parallelize make config
> > Applying: mk: parallelize make config
> > 
> > ➜ [master]GB-2S [dpdk-master] $ rm -rf build
> > ➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 8
> > Configuration done
> > 
> > real    0m2.812s
> > user    0m3.020s
> > sys     0m0.870s
> > 
> > ➜ [master]GB-2S [dpdk-master] $ rm -rf build
> > ➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 16
> > Configuration done
> > 
> > real    0m1.748s
> > user    0m3.040s
> > sys     0m1.020s
> > 
> > ➜ [master]GB-2S [dpdk-master] $ rm -rf build
> > ➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 32
> > Configuration done
> > 
> > real    0m1.422s
> > user    0m3.380s
> > sys     0m1.080s
> > 
> > ➜ [master]GB-2S [dpdk-master] $ pwclient git-am 19918
> > Applying patch #19918 using 'git am'
> > Description: [dpdk-dev] mk: optimize directory dependencies
> > Applying: mk: optimize directory dependencies
> > 
> > ➜ [master]GB-2S [dpdk-master] $ rm -rf build
> > ➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc 
> > Configuration done
> > 
> > real    0m0.064s
> > user    0m0.000s
> > sys     0m0.000s
> > ➜ [master]GB-2S [dpdk-master] $ rm -rf build
> > ➜ [master]GB-2S [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 8
> > Configuration done
> > 
> > real    0m0.055s
> > user    0m0.000s
> > sys     0m0.000s
> >
> 
> I agree that Olivier's patch is faster. However, I think I prefer having
> the library dependencies in the makefiles for the libs themselves rather
> than up a level. Given that we are only looking at ~2second of a
> difference here in your tests - assuming -j flag - what is the actual
> build time differences? My suspicion is that after Ferruh's simpler

Without patch - 18sec
With patch -j1 - 18 sec
With patch -j2 - 9.2 sec
With patch -j4 - 4.9 sec
With patch -j8 - 2.8 sec
With patch -j16 - 1.7 sec
With patch -j32 - 1.4 sec

> patch is applied, the config time becomes such a small part of the
> build, that the extra benefits from Oliviers work is not worth the extra
> complexity.

The low-end embedded SoCs (SoC with 2 to 4 cores) will be get benefited out
of bring this extra complexity.My take is, if it is manageable complexity then
take the most optimized one.

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-23 17:19   ` [dpdk-dev] [PATCH] mk: optimize directory dependencies Olivier Matz
  2017-01-24 11:19     ` Robin Jarry
  2017-01-24 11:40     ` Jerin Jacob
@ 2017-01-24 13:05     ` Ferruh Yigit
  2017-03-17 17:13     ` Olivier Matz
  3 siblings, 0 replies; 38+ messages in thread
From: Ferruh Yigit @ 2017-01-24 13:05 UTC (permalink / raw)
  To: Olivier Matz, dev; +Cc: thomas.monjalon

On 1/23/2017 5:19 PM, Olivier Matz wrote:
> Before this patch, the management of dependencies between directories
> had several issues:
> 
> - the generation of .depdirs, done at configuration is slow: it can take
>   more than one minute on some slow targets (usually ~10s on a standard
>   PC).
> 
> - for instance, it is possible to expressed a dependency like:
>   - app/foo depends on lib/librte_foo
>   - and lib/librte_foo depends on app/bar
>   But this won't work because the directories are traversed with a
>   depth-first algorithm, so we have to choose between doing 'app' before
>   or after 'lib'.
> 
> - the script depdirs-rule.sh is too complex.
> 
> - we cannot use "make -d" for debug, because the output of make is used for
>   the generation of .depdirs.
> 
> This patch moves the DEPDIRS-* variables in the upper Makefile, making
> the dependencies much easier to calculate. A DEPDIRS variable is still
> used to process library dependencies in LDLIBS.
> 
> After this commit, "make config" is almost immediate.
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>

Hi Olivier,

It seems both have pros and cons,

Your patch pros,
- faster
- and simpler implementation.

cons,
- Need to update another Makefile in another level to update
dependencies of a library/driver.
- Root level dependencies hardcoded to a mk level makefile.
- removes depgraph target too, not sure how commonly used



Original implementation pros:
- self contained, it manages dependencies of library in same Makefile
- no hardcoded dependencies, all resolved dynamically

cons,
- relatively slower, but not too bad with -j make option.
- complex implementation


I would prefer my version, surprisingly J, but it is good to have
alternatives, and I don't have strong opinion against your patch.

Thanks,
ferruh

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-24 12:56         ` Jerin Jacob
@ 2017-01-24 13:26           ` Richardson, Bruce
  2017-01-24 14:50             ` Olivier MATZ
  0 siblings, 1 reply; 38+ messages in thread
From: Richardson, Bruce @ 2017-01-24 13:26 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: Olivier Matz, dev, Yigit, Ferruh, thomas.monjalon



> -----Original Message-----
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Tuesday, January 24, 2017 12:57 PM
> To: Richardson, Bruce <bruce.richardson@intel.com>
> Cc: Olivier Matz <olivier.matz@6wind.com>; dev@dpdk.org; Yigit, Ferruh
> <ferruh.yigit@intel.com>; thomas.monjalon@6wind.com
> Subject: Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
> 
> On Tue, Jan 24, 2017 at 12:15:06PM +0000, Bruce Richardson wrote:
> > On Tue, Jan 24, 2017 at 05:10:15PM +0530, Jerin Jacob wrote:
> > > On Mon, Jan 23, 2017 at 06:19:13PM +0100, Olivier Matz wrote:
> > > > Before this patch, the management of dependencies between
> > > > directories had several issues:
> > > >
> > > > - the generation of .depdirs, done at configuration is slow: it can
> take
> > > >   more than one minute on some slow targets (usually ~10s on a
> standard
> > > >   PC).
> > > >
> > > > - for instance, it is possible to expressed a dependency like:
> > > >   - app/foo depends on lib/librte_foo
> > > >   - and lib/librte_foo depends on app/bar
> > > >   But this won't work because the directories are traversed with a
> > > >   depth-first algorithm, so we have to choose between doing 'app'
> before
> > > >   or after 'lib'.
> > > >
> > > > - the script depdirs-rule.sh is too complex.
> > > >
> > > > - we cannot use "make -d" for debug, because the output of make is
> used for
> > > >   the generation of .depdirs.
> > > >
> > > > This patch moves the DEPDIRS-* variables in the upper Makefile,
> > > > making the dependencies much easier to calculate. A DEPDIRS
> > > > variable is still used to process library dependencies in LDLIBS.
> > > >
> > > > After this commit, "make config" is almost immediate.
> > > >
> > > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> > >
> > > Tested both approach on ThunderX. This patch looks better
> > >
> > > Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> > >
> > > ➜ [master]GB-2S [dpdk-master] $ time make config
> > > T=arm64-thunderx-linuxapp-gcc Configuration done
> > >
> > > real    0m18.112s
> > > user    0m2.810s
> > > sys     0m0.660s
> > >
> > > ➜ [master]GB-2S [dpdk-master] $ pwclient git-am 19859 Applying patch
> > > #19859 using 'git am'
> > > Description: [dpdk-dev] mk: parallelize make config
> > > Applying: mk: parallelize make config
> > >
> > > ➜ [master]GB-2S [dpdk-master] $ rm -rf build ➜ [master]GB-2S
> > > [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 8
> > > Configuration done
> > >
> > > real    0m2.812s
> > > user    0m3.020s
> > > sys     0m0.870s
> > >
> > > ➜ [master]GB-2S [dpdk-master] $ rm -rf build ➜ [master]GB-2S
> > > [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 16
> > > Configuration done
> > >
> > > real    0m1.748s
> > > user    0m3.040s
> > > sys     0m1.020s
> > >
> > > ➜ [master]GB-2S [dpdk-master] $ rm -rf build ➜ [master]GB-2S
> > > [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 32
> > > Configuration done
> > >
> > > real    0m1.422s
> > > user    0m3.380s
> > > sys     0m1.080s
> > >
> > > ➜ [master]GB-2S [dpdk-master] $ pwclient git-am 19918 Applying patch
> > > #19918 using 'git am'
> > > Description: [dpdk-dev] mk: optimize directory dependencies
> > > Applying: mk: optimize directory dependencies
> > >
> > > ➜ [master]GB-2S [dpdk-master] $ rm -rf build ➜ [master]GB-2S
> > > [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc
> > > Configuration done
> > >
> > > real    0m0.064s
> > > user    0m0.000s
> > > sys     0m0.000s
> > > ➜ [master]GB-2S [dpdk-master] $ rm -rf build ➜ [master]GB-2S
> > > [dpdk-master] $ time make config T=arm64-thunderx-linuxapp-gcc -j 8
> > > Configuration done
> > >
> > > real    0m0.055s
> > > user    0m0.000s
> > > sys     0m0.000s
> > >
> >
> > I agree that Olivier's patch is faster. However, I think I prefer
> > having the library dependencies in the makefiles for the libs
> > themselves rather than up a level. Given that we are only looking at
> > ~2second of a difference here in your tests - assuming -j flag - what
> > is the actual build time differences? My suspicion is that after
> > Ferruh's simpler
> 
> Without patch - 18sec
> With patch -j1 - 18 sec
> With patch -j2 - 9.2 sec
> With patch -j4 - 4.9 sec
> With patch -j8 - 2.8 sec
> With patch -j16 - 1.7 sec
> With patch -j32 - 1.4 sec
> 
> > patch is applied, the config time becomes such a small part of the
> > build, that the extra benefits from Oliviers work is not worth the
> > extra complexity.
> 
> The low-end embedded SoCs (SoC with 2 to 4 cores) will be get benefited
> out of bring this extra complexity.My take is, if it is manageable
> complexity then take the most optimized one.

Ok. Point taken for the lower-core count parts.

Thomas - can at least one of these patches be merged into 17.02, since it will definitely help us developers? [If Olivier's is too big a change at this point in the cycle, can Ferruh's be taken as an intermediate fix for this release before merging Olivier's in 17.05?]

Regards,
/Bruce

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-24 13:26           ` Richardson, Bruce
@ 2017-01-24 14:50             ` Olivier MATZ
  2017-01-24 14:55               ` Wiles, Keith
  0 siblings, 1 reply; 38+ messages in thread
From: Olivier MATZ @ 2017-01-24 14:50 UTC (permalink / raw)
  To: Richardson, Bruce
  Cc: Jerin Jacob, Olivier Matz, dev, Yigit, Ferruh, thomas.monjalon

On Tue, 24 Jan 2017 13:26:41 +0000, "Richardson, Bruce"
<bruce.richardson@intel.com> wrote:
> 
> Ok. Point taken for the lower-core count parts.
> 
> Thomas - can at least one of these patches be merged into 17.02,
> since it will definitely help us developers? [If Olivier's is too big
> a change at this point in the cycle, can Ferruh's be taken as an
> intermediate fix for this release before merging Olivier's in 17.05?]

It looks to be a good option. Ferruh's patch is less risky for 17.02.

Regards,
Olivier

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-24 14:50             ` Olivier MATZ
@ 2017-01-24 14:55               ` Wiles, Keith
  2017-03-01 11:25                 ` Thomas Monjalon
  0 siblings, 1 reply; 38+ messages in thread
From: Wiles, Keith @ 2017-01-24 14:55 UTC (permalink / raw)
  To: Olivier MATZ
  Cc: Richardson, Bruce, Jerin Jacob, dev, Yigit, Ferruh, thomas.monjalon


> On Jan 24, 2017, at 7:50 AM, Olivier MATZ <olivier.matz@6wind.com> wrote:
> 
> On Tue, 24 Jan 2017 13:26:41 +0000, "Richardson, Bruce"
> <bruce.richardson@intel.com> wrote:
>> 
>> Ok. Point taken for the lower-core count parts.
>> 
>> Thomas - can at least one of these patches be merged into 17.02,
>> since it will definitely help us developers? [If Olivier's is too big
>> a change at this point in the cycle, can Ferruh's be taken as an
>> intermediate fix for this release before merging Olivier's in 17.05?]
> 
> It looks to be a good option. Ferruh's patch is less risky for 17.02.

+1 for Ferruh’s version now and Olivier’s later as it does not require -j.

> 
> Regards,
> Olivier
> 

Regards,
Keith


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

* Re: [dpdk-dev] [PATCH] mk: parallelize make config
  2017-01-22  1:50 [dpdk-dev] [PATCH] mk: parallelize make config Ferruh Yigit
                   ` (2 preceding siblings ...)
  2017-01-24 10:52 ` Bruce Richardson
@ 2017-01-29 15:29 ` Thomas Monjalon
  2017-01-30  9:46   ` Ferruh Yigit
  2017-01-30 10:21 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
  4 siblings, 1 reply; 38+ messages in thread
From: Thomas Monjalon @ 2017-01-29 15:29 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev

2017-01-22 01:50, Ferruh Yigit:
> make config dependency resolving was always running serial,
> parallelize it for better performance.

It could be interesting to explain why it was not parallelized,
and how you made it possible.

The test script should be updated as below:

--- a/devtools/test-build.sh
+++ b/devtools/test-build.sh
-               make T=$2 O=$1 config
+               make -j$J T=$2 O=$1 config


> --- a/mk/internal/rte.depdirs-post.mk
> +++ b/mk/internal/rte.depdirs-post.mk
> @@ -29,11 +29,12 @@
>  #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
>  #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>  
> -.PHONY: depdirs
> -depdirs:
> -	@for d in $(DEPDIRS-y); do \
> -		$(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $$d ; \
> -	done
> +.PHONY: depdirs $(DEPDIRS-y)
> +depdirs: $(DEPDIRS-y)
> +	@echo ""

Why this echo "" ?

> +
> +$(DEPDIRS-y):
> +	@$(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $@


> --- a/mk/rte.sdkdepdirs.mk
> +++ b/mk/rte.sdkdepdirs.mk
> @@ -36,19 +36,22 @@ ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile))
>    $(error "need a make config first")
>  endif
>  
> +DEPDIRS = $(addsuffix /.depdirs, $(addprefix $(BUILDDIR)/,$(ROOTDIRS-y)))

These DEPDIRS are files, although DEPDIRS in other contexts are directories.
I think it should be renamed. DEPDIR_FILES?

>  # use a "for" in a shell to process dependencies: we don't want this
>  # task to be run in parallel.

You forgot to remove this obsolete comment.

>  .PHONY: depdirs
>  depdirs: $(RTE_OUTPUT)/.depdirs
> -$(RTE_OUTPUT)/.depdirs: $(RTE_OUTPUT)/.config
> -	@rm -f $(RTE_OUTPUT)/.depdirs ; \
> -	for d in $(ROOTDIRS-y); do \
> -		if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \
> -			[ -d $(BUILDDIR)/$$d ] || mkdir -p $(BUILDDIR)/$$d ; \
> -			$(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depdirs \
> -				>> $(RTE_OUTPUT)/.depdirs ; \
> -		fi ; \
> -	done
> +$(RTE_OUTPUT)/.depdirs: $(DEPDIRS)
> +	@rm -f $@
> +	@for f in $(DEPDIRS); do cat $$f >> $@; done
> +	@sort -u -o $@ $@
> +
> +$(DEPDIRS): $(RTE_OUTPUT)/.config
> +	@f=$(lastword $(subst /, ,$(dir $@))); \

Could you use $(notdir $(@D)) ?

> +	[ -d $(BUILDDIR)/$$f ] || mkdir -p $(BUILDDIR)/$$f; \
> +	rm -f $@; \

Why this removal?

> +	$(MAKE) S=$$f -f $(RTE_SRCDIR)/$$f/Makefile depdirs >> $@

This part is a bit complicated.
Could it be simplified by better naming $f?


> --- a/mk/rte.subdir.mk
> +++ b/mk/rte.subdir.mk
> @@ -76,7 +76,7 @@ clean: _postclean
>  # include .depdirs and define rules to order priorities between build
>  # of directories.
>  #
> -include $(RTE_OUTPUT)/.depdirs
> +-include $(RTE_OUTPUT)/.depdirs
>  
>  define depdirs_rule
>  $(1): $(sort $(patsubst $(S)/%,%,$(LOCAL_DEPDIRS-$(S)/$(1))))
> @@ -84,16 +84,15 @@ endef
>  
>  $(foreach d,$(DIRS-y),$(eval $(call depdirs_rule,$(d))))
>  
> +DEPDIRS = $(wildcard $(addprefix $(S)/,$(DIRS-y)))
>  
>  # use a "for" in a shell to process dependencies: we don't want this
>  # task to be run in parallel.

You forgot to remove this obsolete comment.

> -.PHONY: depdirs
> -depdirs:
> -	@for d in $(DIRS-y); do \
> -		if [ -f $(SRCDIR)/$$d/Makefile ]; then \
> -			$(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depdirs ; \
> -		fi ; \
> -	done
> +.PHONY: depdirs $(DEPDIRS)
> +depdirs: $(DEPDIRS)
> +
> +$(DEPDIRS):
> +	@$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile depdirs

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

* Re: [dpdk-dev] [PATCH] mk: parallelize make config
  2017-01-23 19:03 ` Michał Mirosław
@ 2017-01-30  9:41   ` Ferruh Yigit
  0 siblings, 0 replies; 38+ messages in thread
From: Ferruh Yigit @ 2017-01-30  9:41 UTC (permalink / raw)
  To: Michał Mirosław; +Cc: dev, Thomas Monjalon

On 1/23/2017 7:03 PM, Michał Mirosław wrote:
> 2017-01-22 2:50 GMT+01:00 Ferruh Yigit <ferruh.yigit@intel.com>:
>> make config dependency resolving was always running serial,
>> parallelize it for better performance.
>>
>> $ time make T=x86_64-native-linuxapp-gcc config
>> real    0m12.633s
>>
>> $ time make -j8 T=x86_64-native-linuxapp-gcc config
>> real    0m1.826s
> [...]
>> +$(RTE_OUTPUT)/.depdirs: $(DEPDIRS)
>> +       @rm -f $@
>> +       @for f in $(DEPDIRS); do cat $$f >> $@; done
>> +       @sort -u -o $@ $@
> 
> This could be just one 'sort -u -o $@ $(DEPDIRS)'

Yes, I will update in next version, thanks.

> 
> Best Regards,
> Michał Mirosław
> 

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

* Re: [dpdk-dev] [PATCH] mk: parallelize make config
  2017-01-29 15:29 ` Thomas Monjalon
@ 2017-01-30  9:46   ` Ferruh Yigit
  0 siblings, 0 replies; 38+ messages in thread
From: Ferruh Yigit @ 2017-01-30  9:46 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

On 1/29/2017 3:29 PM, Thomas Monjalon wrote:
> 2017-01-22 01:50, Ferruh Yigit:
>> make config dependency resolving was always running serial,
>> parallelize it for better performance.
> 
> It could be interesting to explain why it was not parallelized,
> and how you made it possible.

I will try to explain in next version.

> 
> The test script should be updated as below:
> 
> --- a/devtools/test-build.sh
> +++ b/devtools/test-build.sh
> -               make T=$2 O=$1 config
> +               make -j$J T=$2 O=$1 config

I will update.

> 
> 
>> --- a/mk/internal/rte.depdirs-post.mk
>> +++ b/mk/internal/rte.depdirs-post.mk
>> @@ -29,11 +29,12 @@
>>  #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
>>  #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>>  
>> -.PHONY: depdirs
>> -depdirs:
>> -	@for d in $(DEPDIRS-y); do \
>> -		$(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $$d ; \
>> -	done
>> +.PHONY: depdirs $(DEPDIRS-y)
>> +depdirs: $(DEPDIRS-y)
>> +	@echo ""
> 
> Why this echo "" ?

If there is no dependency (DEPDIRS-y) set and there is nothing to do
here, make prints a line like "nothing to do", since we redirect the
output to the files, that msg goes into .depdir files. To prevent that
msg, added a dummy action here.

> 
>> +
>> +$(DEPDIRS-y):
>> +	@$(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $@
> 
> 
>> --- a/mk/rte.sdkdepdirs.mk
>> +++ b/mk/rte.sdkdepdirs.mk
>> @@ -36,19 +36,22 @@ ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile))
>>    $(error "need a make config first")
>>  endif
>>  
>> +DEPDIRS = $(addsuffix /.depdirs, $(addprefix $(BUILDDIR)/,$(ROOTDIRS-y)))
> 
> These DEPDIRS are files, although DEPDIRS in other contexts are directories.
> I think it should be renamed. DEPDIR_FILES?

Make sense, I will update.

> 
>>  # use a "for" in a shell to process dependencies: we don't want this
>>  # task to be run in parallel.
> 
> You forgot to remove this obsolete comment.

Will update on next version.

> 
>>  .PHONY: depdirs
>>  depdirs: $(RTE_OUTPUT)/.depdirs
>> -$(RTE_OUTPUT)/.depdirs: $(RTE_OUTPUT)/.config
>> -	@rm -f $(RTE_OUTPUT)/.depdirs ; \
>> -	for d in $(ROOTDIRS-y); do \
>> -		if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \
>> -			[ -d $(BUILDDIR)/$$d ] || mkdir -p $(BUILDDIR)/$$d ; \
>> -			$(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depdirs \
>> -				>> $(RTE_OUTPUT)/.depdirs ; \
>> -		fi ; \
>> -	done
>> +$(RTE_OUTPUT)/.depdirs: $(DEPDIRS)
>> +	@rm -f $@
>> +	@for f in $(DEPDIRS); do cat $$f >> $@; done
>> +	@sort -u -o $@ $@
>> +
>> +$(DEPDIRS): $(RTE_OUTPUT)/.config
>> +	@f=$(lastword $(subst /, ,$(dir $@))); \
> 
> Could you use $(notdir $(@D)) ?

Can be, I will try.

> 
>> +	[ -d $(BUILDDIR)/$$f ] || mkdir -p $(BUILDDIR)/$$f; \
>> +	rm -f $@; \
> 
> Why this removal?

To be sure we are not using old files, but this can be done below line
with using ">" I guess.

> 
>> +	$(MAKE) S=$$f -f $(RTE_SRCDIR)/$$f/Makefile depdirs >> $@
> 
> This part is a bit complicated.
> Could it be simplified by better naming $f?

I will try.

> 
> 
>> --- a/mk/rte.subdir.mk
>> +++ b/mk/rte.subdir.mk
>> @@ -76,7 +76,7 @@ clean: _postclean
>>  # include .depdirs and define rules to order priorities between build
>>  # of directories.
>>  #
>> -include $(RTE_OUTPUT)/.depdirs
>> +-include $(RTE_OUTPUT)/.depdirs
>>  
>>  define depdirs_rule
>>  $(1): $(sort $(patsubst $(S)/%,%,$(LOCAL_DEPDIRS-$(S)/$(1))))
>> @@ -84,16 +84,15 @@ endef
>>  
>>  $(foreach d,$(DIRS-y),$(eval $(call depdirs_rule,$(d))))
>>  
>> +DEPDIRS = $(wildcard $(addprefix $(S)/,$(DIRS-y)))
>>  
>>  # use a "for" in a shell to process dependencies: we don't want this
>>  # task to be run in parallel.
> 
> You forgot to remove this obsolete comment.

Right, will update.

> 
>> -.PHONY: depdirs
>> -depdirs:
>> -	@for d in $(DIRS-y); do \
>> -		if [ -f $(SRCDIR)/$$d/Makefile ]; then \
>> -			$(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depdirs ; \
>> -		fi ; \
>> -	done
>> +.PHONY: depdirs $(DEPDIRS)
>> +depdirs: $(DEPDIRS)
>> +
>> +$(DEPDIRS):
>> +	@$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile depdirs
> 

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

* [dpdk-dev] [PATCH v2] mk: parallelize make config
  2017-01-22  1:50 [dpdk-dev] [PATCH] mk: parallelize make config Ferruh Yigit
                   ` (3 preceding siblings ...)
  2017-01-29 15:29 ` Thomas Monjalon
@ 2017-01-30 10:21 ` Ferruh Yigit
  2017-01-30 18:13   ` Thomas Monjalon
  4 siblings, 1 reply; 38+ messages in thread
From: Ferruh Yigit @ 2017-01-30 10:21 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Ferruh Yigit

make config dependency resolving was always running serial,
parallelize it for better performance.

$ time make T=x86_64-native-linuxapp-gcc config
real    0m12.633s

$ time make -j8 T=x86_64-native-linuxapp-gcc config
real    0m1.826s

When config creation done under a single make target, using a for loop,
make has no control on the action, and it needs to run as implemented in
the rule. But if for loop converted into multiple targets, make can
detect independent targets and run them parallel based on -j parameter.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 devtools/test-build.sh          |  2 +-
 mk/internal/rte.depdirs-post.mk | 11 ++++++-----
 mk/rte.sdkdepdirs.mk            | 21 ++++++++++-----------
 mk/rte.subdir.mk                | 17 +++++++----------
 4 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/devtools/test-build.sh b/devtools/test-build.sh
index 680d79b..0f131fc 100755
--- a/devtools/test-build.sh
+++ b/devtools/test-build.sh
@@ -146,7 +146,7 @@ config () # <directory> <target> <options>
 	fi
 	if [ ! -e $1/.config ] || $reconfig ; then
 		echo "================== Configure $1"
-		make T=$2 O=$1 config
+		make -j$J T=$2 O=$1 config
 
 		echo 'Customize configuration'
 		# Built-in options (lowercase)
diff --git a/mk/internal/rte.depdirs-post.mk b/mk/internal/rte.depdirs-post.mk
index 102a369..eb73ad3 100644
--- a/mk/internal/rte.depdirs-post.mk
+++ b/mk/internal/rte.depdirs-post.mk
@@ -29,11 +29,12 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-.PHONY: depdirs
-depdirs:
-	@for d in $(DEPDIRS-y); do \
-		$(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $$d ; \
-	done
+.PHONY: depdirs $(DEPDIRS-y)
+depdirs: $(DEPDIRS-y)
+	@echo ""
+
+$(DEPDIRS-y):
+	@$(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $@
 
 .PHONY: depgraph
 depgraph:
diff --git a/mk/rte.sdkdepdirs.mk b/mk/rte.sdkdepdirs.mk
index bebaf2a..38fd863 100644
--- a/mk/rte.sdkdepdirs.mk
+++ b/mk/rte.sdkdepdirs.mk
@@ -36,19 +36,18 @@ ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile))
   $(error "need a make config first")
 endif
 
-# use a "for" in a shell to process dependencies: we don't want this
-# task to be run in parallel.
+DEPDIR_FILES = $(addsuffix /.depdirs, $(addprefix $(BUILDDIR)/,$(ROOTDIRS-y)))
+
 .PHONY: depdirs
 depdirs: $(RTE_OUTPUT)/.depdirs
-$(RTE_OUTPUT)/.depdirs: $(RTE_OUTPUT)/.config
-	@rm -f $(RTE_OUTPUT)/.depdirs ; \
-	for d in $(ROOTDIRS-y); do \
-		if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \
-			[ -d $(BUILDDIR)/$$d ] || mkdir -p $(BUILDDIR)/$$d ; \
-			$(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depdirs \
-				>> $(RTE_OUTPUT)/.depdirs ; \
-		fi ; \
-	done
+$(RTE_OUTPUT)/.depdirs: $(DEPDIR_FILES)
+	@rm -f $@
+	@sort -u -o $@ $(DEPDIR_FILES)
+
+$(DEPDIR_FILES): $(RTE_OUTPUT)/.config
+	@dir=$(notdir $(@D)); \
+	[ -d $(BUILDDIR)/$$dir ] || mkdir -p $(BUILDDIR)/$$dir; \
+	$(MAKE) S=$$dir -f $(RTE_SRCDIR)/$$dir/Makefile depdirs > $@
 
 .PHONY: depgraph
 depgraph:
diff --git a/mk/rte.subdir.mk b/mk/rte.subdir.mk
index 256e64e..5341f1f 100644
--- a/mk/rte.subdir.mk
+++ b/mk/rte.subdir.mk
@@ -76,7 +76,7 @@ clean: _postclean
 # include .depdirs and define rules to order priorities between build
 # of directories.
 #
-include $(RTE_OUTPUT)/.depdirs
+-include $(RTE_OUTPUT)/.depdirs
 
 define depdirs_rule
 $(1): $(sort $(patsubst $(S)/%,%,$(LOCAL_DEPDIRS-$(S)/$(1))))
@@ -84,16 +84,13 @@ endef
 
 $(foreach d,$(DIRS-y),$(eval $(call depdirs_rule,$(d))))
 
+DEPDIRS = $(wildcard $(addprefix $(S)/,$(DIRS-y)))
 
-# use a "for" in a shell to process dependencies: we don't want this
-# task to be run in parallel.
-.PHONY: depdirs
-depdirs:
-	@for d in $(DIRS-y); do \
-		if [ -f $(SRCDIR)/$$d/Makefile ]; then \
-			$(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depdirs ; \
-		fi ; \
-	done
+.PHONY: depdirs $(DEPDIRS)
+depdirs: $(DEPDIRS)
+
+$(DEPDIRS):
+	@$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile depdirs
 
 .PHONY: depgraph
 depgraph:
-- 
2.9.3

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

* Re: [dpdk-dev] [PATCH v2] mk: parallelize make config
  2017-01-30 10:21 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
@ 2017-01-30 18:13   ` Thomas Monjalon
  0 siblings, 0 replies; 38+ messages in thread
From: Thomas Monjalon @ 2017-01-30 18:13 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev

2017-01-30 10:21, Ferruh Yigit:
> make config dependency resolving was always running serial,
> parallelize it for better performance.
> 
> $ time make T=x86_64-native-linuxapp-gcc config
> real    0m12.633s
> 
> $ time make -j8 T=x86_64-native-linuxapp-gcc config
> real    0m1.826s
> 
> When config creation done under a single make target, using a for loop,
> make has no control on the action, and it needs to run as implemented in
> the rule. But if for loop converted into multiple targets, make can
> detect independent targets and run them parallel based on -j parameter.
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Looks a good improvement, thanks Ferruh.

Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Applied

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-24 14:55               ` Wiles, Keith
@ 2017-03-01 11:25                 ` Thomas Monjalon
  2017-03-01 12:10                   ` Bruce Richardson
  2017-03-01 12:30                   ` Olivier Matz
  0 siblings, 2 replies; 38+ messages in thread
From: Thomas Monjalon @ 2017-03-01 11:25 UTC (permalink / raw)
  To: Wiles, Keith, Olivier MATZ, Richardson, Bruce, Jerin Jacob,
	Yigit, Ferruh
  Cc: dev

2017-01-24 14:55, Wiles, Keith:
> > On Jan 24, 2017, at 7:50 AM, Olivier MATZ <olivier.matz@6wind.com> wrote:
> > On Tue, 24 Jan 2017 13:26:41 +0000, "Richardson, Bruce"
> > <bruce.richardson@intel.com> wrote:
> >> 
> >> Ok. Point taken for the lower-core count parts.
> >> 
> >> Thomas - can at least one of these patches be merged into 17.02,
> >> since it will definitely help us developers? [If Olivier's is too big
> >> a change at this point in the cycle, can Ferruh's be taken as an
> >> intermediate fix for this release before merging Olivier's in 17.05?]
> > 
> > It looks to be a good option. Ferruh's patch is less risky for 17.02.
> 
> +1 for Ferruh’s version now and Olivier’s later as it does not require -j.

The Ferruh's version has been merged in 17.02.
Are we still OK to take Olivier's version in 17.05?

Olivier, are you going to update/rebase it?

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-03-01 11:25                 ` Thomas Monjalon
@ 2017-03-01 12:10                   ` Bruce Richardson
  2017-03-01 12:30                   ` Olivier Matz
  1 sibling, 0 replies; 38+ messages in thread
From: Bruce Richardson @ 2017-03-01 12:10 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Wiles, Keith, Olivier MATZ, Jerin Jacob, Yigit, Ferruh, dev

On Wed, Mar 01, 2017 at 12:25:45PM +0100, Thomas Monjalon wrote:
> 2017-01-24 14:55, Wiles, Keith:
> > > On Jan 24, 2017, at 7:50 AM, Olivier MATZ <olivier.matz@6wind.com> wrote:
> > > On Tue, 24 Jan 2017 13:26:41 +0000, "Richardson, Bruce"
> > > <bruce.richardson@intel.com> wrote:
> > >> 
> > >> Ok. Point taken for the lower-core count parts.
> > >> 
> > >> Thomas - can at least one of these patches be merged into 17.02,
> > >> since it will definitely help us developers? [If Olivier's is too big
> > >> a change at this point in the cycle, can Ferruh's be taken as an
> > >> intermediate fix for this release before merging Olivier's in 17.05?]
> > > 
> > > It looks to be a good option. Ferruh's patch is less risky for 17.02.
> > 
> > +1 for Ferruh’s version now and Olivier’s later as it does not require -j.
> 
> The Ferruh's version has been merged in 17.02.
> Are we still OK to take Olivier's version in 17.05?
> 
No objection on my side.
/Bruce

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-03-01 11:25                 ` Thomas Monjalon
  2017-03-01 12:10                   ` Bruce Richardson
@ 2017-03-01 12:30                   ` Olivier Matz
  1 sibling, 0 replies; 38+ messages in thread
From: Olivier Matz @ 2017-03-01 12:30 UTC (permalink / raw)
  To: Thomas Monjalon
  Cc: Wiles, Keith, Richardson, Bruce, Jerin Jacob, Yigit, Ferruh, dev

On Wed, 01 Mar 2017 12:25:45 +0100, Thomas Monjalon <thomas.monjalon@6wind.com> wrote:
> 2017-01-24 14:55, Wiles, Keith:
> > > On Jan 24, 2017, at 7:50 AM, Olivier MATZ <olivier.matz@6wind.com> wrote:
> > > On Tue, 24 Jan 2017 13:26:41 +0000, "Richardson, Bruce"
> > > <bruce.richardson@intel.com> wrote:  
> > >> 
> > >> Ok. Point taken for the lower-core count parts.
> > >> 
> > >> Thomas - can at least one of these patches be merged into 17.02,
> > >> since it will definitely help us developers? [If Olivier's is too big
> > >> a change at this point in the cycle, can Ferruh's be taken as an
> > >> intermediate fix for this release before merging Olivier's in 17.05?]  
> > > 
> > > It looks to be a good option. Ferruh's patch is less risky for 17.02.  
> > 
> > +1 for Ferruh’s version now and Olivier’s later as it does not require -j.  
> 
> The Ferruh's version has been merged in 17.02.
> Are we still OK to take Olivier's version in 17.05?
> 
> Olivier, are you going to update/rebase it?

Yep, will do.

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

* [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-01-23 17:19   ` [dpdk-dev] [PATCH] mk: optimize directory dependencies Olivier Matz
                       ` (2 preceding siblings ...)
  2017-01-24 13:05     ` Ferruh Yigit
@ 2017-03-17 17:13     ` Olivier Matz
  2017-03-17 17:47       ` Robin Jarry
  2017-03-24 13:21       ` [dpdk-dev] [PATCH v2] " Olivier Matz
  3 siblings, 2 replies; 38+ messages in thread
From: Olivier Matz @ 2017-03-17 17:13 UTC (permalink / raw)
  To: dev; +Cc: thomas.monjalon, ferruh.yigit, robin.jarry, jerin.jacob, keith.wiles

Before this patch, the management of dependencies between directories
had several issues:

- the generation of .depdirs, done at configuration is slow: it can take
  more than one minute on some slow targets (usually ~10s on a standard
  PC without -j).

- for instance, it is possible to express a dependency like:
  - app/foo depends on lib/librte_foo
  - and lib/librte_foo depends on app/bar
  But this won't work because the directories are traversed with a
  depth-first algorithm, so we have to choose between doing 'app' before
  or after 'lib'.

- the script depdirs-rule.sh is too complex.

- we cannot use "make -d" for debug, because the output of make is used for
  the generation of .depdirs.

This patch moves the DEPDIRS-* variables in the upper Makefile, making
the dependencies much easier to calculate. A DEPDIRS variable is still
used to process library dependencies in LDLIBS.

After this commit, "make config" is almost immediate.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Robin Jarry <robin.jarry@6wind.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---

RFC -> v1:                                                                                              
- rebase on top of current master
- interleave DIRS-* and DEPDIRS-* targets for more readability


 MAINTAINERS                                      |  1 -
 app/pdump/Makefile                               |  1 -
 app/proc_info/Makefile                           |  3 -
 app/test-crypto-perf/Makefile                    |  3 -
 app/test-pmd/Makefile                            |  1 -
 buildtools/depdirs-rule.sh                       | 95 ------------------------
 buildtools/pmdinfogen/Makefile                   |  2 -
 devtools/test-build.sh                           |  2 +-
 doc/guides/prog_guide/dev_kit_build_system.rst   |  2 +-
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 28 -------
 drivers/crypto/Makefile                          | 12 +++
 drivers/crypto/aesni_gcm/Makefile                |  7 --
 drivers/crypto/aesni_mb/Makefile                 |  7 --
 drivers/crypto/armv8/Makefile                    |  7 --
 drivers/crypto/kasumi/Makefile                   |  7 --
 drivers/crypto/null/Makefile                     |  7 --
 drivers/crypto/openssl/Makefile                  |  7 --
 drivers/crypto/qat/Makefile                      |  7 --
 drivers/crypto/scheduler/Makefile                |  8 --
 drivers/crypto/snow3g/Makefile                   |  7 --
 drivers/crypto/zuc/Makefile                      |  7 --
 drivers/net/Makefile                             | 29 ++++++++
 drivers/net/af_packet/Makefile                   |  7 --
 drivers/net/bnx2x/Makefile                       |  4 -
 drivers/net/bnxt/Makefile                        |  6 --
 drivers/net/bonding/Makefile                     |  9 ---
 drivers/net/cxgbe/Makefile                       |  5 --
 drivers/net/e1000/Makefile                       |  5 --
 drivers/net/ena/Makefile                         |  5 --
 drivers/net/enic/Makefile                        |  6 --
 drivers/net/fm10k/Makefile                       |  6 --
 drivers/net/i40e/Makefile                        |  7 --
 drivers/net/ixgbe/Makefile                       |  6 --
 drivers/net/mlx4/Makefile                        |  6 --
 drivers/net/mlx5/Makefile                        |  7 --
 drivers/net/nfp/Makefile                         |  5 --
 drivers/net/null/Makefile                        |  7 --
 drivers/net/pcap/Makefile                        |  7 --
 drivers/net/qede/Makefile                        |  5 --
 drivers/net/ring/Makefile                        |  5 --
 drivers/net/sfc/Makefile                         |  8 --
 drivers/net/szedata2/Makefile                    |  7 --
 drivers/net/tap/Makefile                         |  7 --
 drivers/net/thunderx/Makefile                    |  4 -
 drivers/net/vhost/Makefile                       |  8 --
 drivers/net/virtio/Makefile                      |  6 --
 drivers/net/vmxnet3/Makefile                     |  5 --
 drivers/net/xenvirt/Makefile                     |  6 --
 examples/ethtool/Makefile                        |  3 +
 examples/ethtool/lib/Makefile                    |  4 -
 lib/Makefile                                     | 34 +++++++++
 lib/librte_acl/Makefile                          |  3 -
 lib/librte_cfgfile/Makefile                      |  3 -
 lib/librte_cmdline/Makefile                      |  3 -
 lib/librte_cryptodev/Makefile                    |  7 --
 lib/librte_distributor/Makefile                  |  4 -
 lib/librte_eal/Makefile                          |  2 +
 lib/librte_eal/bsdapp/eal/Makefile               |  3 -
 lib/librte_eal/linuxapp/Makefile                 |  2 +
 lib/librte_eal/linuxapp/eal/Makefile             |  3 -
 lib/librte_eal/linuxapp/kni/Makefile             |  3 -
 lib/librte_eal/linuxapp/xen_dom0/Makefile        |  3 -
 lib/librte_efd/Makefile                          |  5 --
 lib/librte_ether/Makefile                        |  3 -
 lib/librte_hash/Makefile                         |  3 -
 lib/librte_ip_frag/Makefile                      |  6 --
 lib/librte_jobstats/Makefile                     |  3 -
 lib/librte_kni/Makefile                          |  5 --
 lib/librte_kvargs/Makefile                       |  3 -
 lib/librte_lpm/Makefile                          |  3 -
 lib/librte_mbuf/Makefile                         |  3 -
 lib/librte_mempool/Makefile                      |  2 -
 lib/librte_meter/Makefile                        |  3 -
 lib/librte_net/Makefile                          |  2 -
 lib/librte_pdump/Makefile                        |  6 --
 lib/librte_pipeline/Makefile                     |  7 --
 lib/librte_port/Makefile                         | 11 ---
 lib/librte_power/Makefile                        |  3 -
 lib/librte_reorder/Makefile                      |  5 --
 lib/librte_ring/Makefile                         |  2 -
 lib/librte_sched/Makefile                        |  5 --
 lib/librte_table/Makefile                        | 11 ---
 lib/librte_timer/Makefile                        |  3 -
 lib/librte_vhost/Makefile                        |  7 --
 mk/internal/rte.depdirs-post.mk                  | 43 -----------
 mk/internal/rte.depdirs-pre.mk                   | 32 --------
 mk/rte.app.mk                                    |  2 -
 mk/rte.bsdmodule.mk                              |  2 -
 mk/rte.extsubdir.mk                              | 14 ++++
 mk/rte.gnuconfigure.mk                           |  2 -
 mk/rte.hostapp.mk                                |  2 -
 mk/rte.hostlib.mk                                |  2 -
 mk/rte.install.mk                                |  2 -
 mk/rte.lib.mk                                    | 10 +--
 mk/rte.module.mk                                 |  2 -
 mk/rte.obj.mk                                    |  2 -
 mk/rte.sdkbuild.mk                               | 20 ++---
 mk/rte.sdkconfig.mk                              |  2 -
 mk/rte.sdkdepdirs.mk                             | 26 -------
 mk/rte.sdkroot.mk                                |  4 -
 mk/rte.shared.mk                                 |  2 -
 mk/rte.subdir.mk                                 | 37 +++------
 test/cmdline_test/Makefile                       |  3 -
 test/test-acl/Makefile                           |  1 -
 test/test-pipeline/Makefile                      |  3 -
 test/test/Makefile                               |  3 -
 106 files changed, 119 insertions(+), 684 deletions(-)
 delete mode 100755 buildtools/depdirs-rule.sh
 delete mode 100644 mk/internal/rte.depdirs-post.mk
 delete mode 100644 mk/internal/rte.depdirs-pre.mk

diff --git a/MAINTAINERS b/MAINTAINERS
index 39bc78e..6eeb6f4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -57,7 +57,6 @@ F: config/
 F: mk/
 F: pkg/
 F: buildtools/auto-config-h.sh
-F: buildtools/depdirs-rule.sh
 F: buildtools/gen-build-mk.sh
 F: buildtools/gen-config-h.sh
 F: buildtools/relpath.sh
diff --git a/app/pdump/Makefile b/app/pdump/Makefile
index 536198f..8ec6bd6 100644
--- a/app/pdump/Makefile
+++ b/app/pdump/Makefile
@@ -42,7 +42,6 @@ CFLAGS += $(WERROR_FLAGS)
 SRCS-y := main.c
 
 # this application needs libraries first
-DEPDIRS-y += lib
 
 include $(RTE_SDK)/mk/rte.app.mk
 
diff --git a/app/proc_info/Makefile b/app/proc_info/Makefile
index e051e03..9e90438 100644
--- a/app/proc_info/Makefile
+++ b/app/proc_info/Makefile
@@ -39,7 +39,4 @@ CFLAGS += $(WERROR_FLAGS)
 
 SRCS-y := main.c
 
-# this application needs libraries first
-DEPDIRS-y += lib
-
 include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-crypto-perf/Makefile b/app/test-crypto-perf/Makefile
index 276ba68..5120b88 100644
--- a/app/test-crypto-perf/Makefile
+++ b/app/test-crypto-perf/Makefile
@@ -44,7 +44,4 @@ SRCS-y += cperf_test_throughput.c
 SRCS-y += cperf_test_latency.c
 SRCS-y += cperf_test_vector_parsing.c
 
-# this application needs libraries first
-DEPDIRS-y += lib
-
 include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index eec1ed0..3be1ae8 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -82,7 +82,6 @@ endif
 CFLAGS_cmdline.o := -D_GNU_SOURCE
 
 # this application needs libraries first
-DEPDIRS-y += lib drivers
 
 include $(RTE_SDK)/mk/rte.app.mk
 
diff --git a/buildtools/depdirs-rule.sh b/buildtools/depdirs-rule.sh
deleted file mode 100755
index 7aba088..0000000
--- a/buildtools/depdirs-rule.sh
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/sh
-
-#   BSD LICENSE
-#
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   All rights reserved.
-#
-#   Redistribution and use in source and binary forms, with or without
-#   modification, are permitted provided that the following conditions
-#   are met:
-#
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in
-#       the documentation and/or other materials provided with the
-#       distribution.
-#     * Neither the name of Intel Corporation nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
-#
-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#
-# This (obscure) bash script finds the smallest different path between
-# path1 and path2 given as command line argument. The given paths MUST
-# be relative paths, the script is not designed to work with absolute
-# paths.
-#
-# The script will then generate Makefile code that can be saved in a
-# file and included in build system.
-#
-# For instance:
-#   depdirs-rule.sh a/b/c/d a/b/e/f
-# Will print:
-#   FULL_DEPDIRS-a/b/c/d += a/b/e/f
-#   LOCAL_DEPDIRS-a/b/c += a/b/e
-#
-# The script returns 0 except if invalid arguments are given.
-#
-
-if [ $# -ne 2 ]; then
-	echo "Bad arguments"
-	echo "Usage:"
-	echo "  $0 path1 path2"
-	exit 1
-fi
-
-left1=${1%%/*}
-right1=${1#*/}
-prev_right1=$1
-prev_left1=
-
-left2=${2%%/*}
-right2=${2#*/}
-prev_right2=$2
-prev_left2=
-
-while [ "${right1}" != "" -a "${right2}" != "" ]; do
-
-	if [ "$left1" != "$left2" ]; then
-		break
-	fi
-
-	prev_left1=$left1
-	left1=$left1/${right1%%/*}
-	prev_right1=$right1
-	right1=${prev_right1#*/}
-	if [ "$right1" = "$prev_right1" ]; then
-		right1=""
-	fi
-
-	prev_left2=$left2
-	left2=$left2/${right2%%/*}
-	prev_right2=$right2
-	right2=${prev_right2#*/}
-	if [ "$right2" = "$prev_right2" ]; then
-		right2=""
-	fi
-done
-
-echo FULL_DEPDIRS-$1 += $2
-echo LOCAL_DEPDIRS-$left1 += $left2
-
-exit 0
diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bd8f900..bf07b6f 100644
--- a/buildtools/pmdinfogen/Makefile
+++ b/buildtools/pmdinfogen/Makefile
@@ -44,6 +44,4 @@ SRCS-y += pmdinfogen.c
 HOST_CFLAGS += $(WERROR_FLAGS) -g
 HOST_CFLAGS += -I$(RTE_OUTPUT)/include
 
-DEPDIRS-y += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.hostapp.mk
diff --git a/devtools/test-build.sh b/devtools/test-build.sh
index 84d3165..5fed4c1 100755
--- a/devtools/test-build.sh
+++ b/devtools/test-build.sh
@@ -146,7 +146,7 @@ config () # <directory> <target> <options>
 	fi
 	if [ ! -e $1/.config ] || $reconfig ; then
 		echo "================== Configure $1"
-		make -j$J T=$2 O=$1 config
+		make T=$2 O=$1 config
 
 		echo 'Customize configuration'
 		# Built-in options (lowercase)
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst b/doc/guides/prog_guide/dev_kit_build_system.rst
index 19de156..ad032c5 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -367,7 +367,7 @@ Variables that Can be Set/Overridden in a Makefile Only
 
 *   POSTCLEAN: A list of actions to be taken after cleaning. The user should use += to append data in this variable.
 
-*   DEPDIR-y: Only used in the development kit framework to specify if the build of the current directory depends on build of another one.
+*   DEPDIRS-$(DIR): Only used in the development kit framework to specify if the build of the current directory depends on build of another one.
     This is needed to support parallel builds correctly.
 
 Variables that can be Set/Overridden by the User on the Command Line Only
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index fb3520e..d7c4106 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -152,34 +152,6 @@ Documentation Targets
 
     Generate the guides documentation in pdf.
 
-
-Deps Targets
-------------
-
-*   depdirs
-
-    This target is implicitly called by make config.
-    Typically, there is no need for a user to call it,
-    except if DEPDIRS-y variables have been updated in Makefiles.
-    It will generate the file  $(RTE_OUTPUT)/.depdirs.
-
-    Example:
-
-    .. code-block:: console
-
-        make depdirs O=mybuild
-
-*   depgraph
-
-    This command generates a dot graph of dependencies.
-    It can be displayed to debug circular dependency issues, or just to understand the dependencies.
-
-    Example:
-
-    .. code-block:: console
-
-        make depgraph O=mybuild > /tmp/graph.dot && dotty /tmp/ graph.dot
-
 Misc Targets
 ------------
 
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index a5a246b..652c554 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -31,15 +31,27 @@
 
 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)
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/crypto/aesni_gcm/Makefile b/drivers/crypto/aesni_gcm/Makefile
index fb17fbf..59a7c6a 100644
--- a/drivers/crypto/aesni_gcm/Makefile
+++ b/drivers/crypto/aesni_gcm/Makefile
@@ -56,11 +56,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm_pmd_ops.c
 # export include files
 SYMLINK-y-include +=
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/aesni_mb/Makefile b/drivers/crypto/aesni_mb/Makefile
index d3994cc..611d412 100644
--- a/drivers/crypto/aesni_mb/Makefile
+++ b/drivers/crypto/aesni_mb/Makefile
@@ -58,11 +58,4 @@ LDLIBS += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/armv8/Makefile b/drivers/crypto/armv8/Makefile
index 2003ec4..1474951 100644
--- a/drivers/crypto/armv8/Makefile
+++ b/drivers/crypto/armv8/Makefile
@@ -62,11 +62,4 @@ LDLIBS += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += rte_armv8_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += rte_armv8_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/kasumi/Makefile b/drivers/crypto/kasumi/Makefile
index 9fb0be8..b47cda0 100644
--- a/drivers/crypto/kasumi/Makefile
+++ b/drivers/crypto/kasumi/Makefile
@@ -59,11 +59,4 @@ LDLIBS += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/null/Makefile b/drivers/crypto/null/Makefile
index c143929..bc2724b 100644
--- a/drivers/crypto/null/Makefile
+++ b/drivers/crypto/null/Makefile
@@ -51,11 +51,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += null_crypto_pmd_ops.c
 # export include files
 SYMLINK-y-include +=
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/openssl/Makefile b/drivers/crypto/openssl/Makefile
index 8c4250c..e5fdfb5 100644
--- a/drivers/crypto/openssl/Makefile
+++ b/drivers/crypto/openssl/Makefile
@@ -50,11 +50,4 @@ LDLIBS += -lcrypto
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += rte_openssl_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += rte_openssl_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile
index 20a70d4..7322ffe 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/crypto/qat/Makefile
@@ -56,11 +56,4 @@ SYMLINK-y-include +=
 # versioning export map
 EXPORT_MAP := rte_pmd_qat_version.map
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += lib/librte_cryptodev
-
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/scheduler/Makefile b/drivers/crypto/scheduler/Makefile
index 0cce6f2..187d3b6 100644
--- a/drivers/crypto/scheduler/Makefile
+++ b/drivers/crypto/scheduler/Makefile
@@ -55,12 +55,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler_pmd_ops.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += rte_cryptodev_scheduler.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler_roundrobin.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_cryptodev
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_reorder
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/snow3g/Makefile b/drivers/crypto/snow3g/Makefile
index bea6760..ecee80d 100644
--- a/drivers/crypto/snow3g/Makefile
+++ b/drivers/crypto/snow3g/Makefile
@@ -59,11 +59,4 @@ LDLIBS += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/zuc/Makefile b/drivers/crypto/zuc/Makefile
index b15eb0f..f543b40 100644
--- a/drivers/crypto/zuc/Makefile
+++ b/drivers/crypto/zuc/Makefile
@@ -59,11 +59,4 @@ LDLIBS += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index a16f25e..07d283b 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -31,34 +31,63 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+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_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_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_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_MLX4_PMD) += mlx4
+DEPDIRS-mlx4 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5
+DEPDIRS-mlx5 = $(core-libs)
 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_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)
 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)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
+DEPDIRS-xenvirt = $(core-libs)
 
 ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += vhost
 endif # $(CONFIG_RTE_LIBRTE_VHOST)
+DEPDIRS-vhost = $(core-libs) librte_vhost
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/net/af_packet/Makefile b/drivers/net/af_packet/Makefile
index e14d6d0..70d517c 100644
--- a/drivers/net/af_packet/Makefile
+++ b/drivers/net/af_packet/Makefile
@@ -50,11 +50,4 @@ CFLAGS += $(WERROR_FLAGS)
 #
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += rte_eth_af_packet.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/bnx2x/Makefile b/drivers/net/bnx2x/Makefile
index e971fb6..e123106 100644
--- a/drivers/net/bnx2x/Makefile
+++ b/drivers/net/bnx2x/Makefile
@@ -29,8 +29,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += ecore_sp.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += elink.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_vfpf.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += lib/librte_mempool lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile
index 65aaa92..0fffe35 100644
--- a/drivers/net/bnxt/Makefile
+++ b/drivers/net/bnxt/Makefile
@@ -66,10 +66,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_irq.c
 #
 SYMLINK-y-include +=
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile
index 504f2e8..910c932 100644
--- a/drivers/net/bonding/Makefile
+++ b/drivers/net/bonding/Makefile
@@ -58,13 +58,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += rte_eth_bond_alb.c
 SYMLINK-y-include += rte_eth_bond.h
 SYMLINK-y-include += rte_eth_bond_8023ad.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_cmdline
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ring
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/cxgbe/Makefile b/drivers/net/cxgbe/Makefile
index bfcc315..7cef627 100644
--- a/drivers/net/cxgbe/Makefile
+++ b/drivers/net/cxgbe/Makefile
@@ -81,9 +81,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += sge.c
 SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += t4_hw.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
index 57a60f0..a32fabe 100644
--- a/drivers/net/e1000/Makefile
+++ b/drivers/net/e1000/Makefile
@@ -96,9 +96,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_IGB_PMD) += igb_pf.c
 SRCS-$(CONFIG_RTE_LIBRTE_EM_PMD) += em_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EM_PMD) += em_rxtx.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/ena/Makefile b/drivers/net/ena/Makefile
index a0d3358..bf1f5da 100644
--- a/drivers/net/ena/Makefile
+++ b/drivers/net/ena/Makefile
@@ -51,11 +51,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena_com.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena_eth_com.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += lib/librte_net
-
 CFLAGS += $(INCLUDES)
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enic/Makefile b/drivers/net/enic/Makefile
index 3926b79..2c7496d 100644
--- a/drivers/net/enic/Makefile
+++ b/drivers/net/enic/Makefile
@@ -63,10 +63,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_intr.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_rq.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_rss.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/fm10k/Makefile b/drivers/net/fm10k/Makefile
index afcbd1d..71d836c 100644
--- a/drivers/net/fm10k/Makefile
+++ b/drivers/net/fm10k/Makefile
@@ -96,10 +96,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k_vf.c
 SRCS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k_api.c
 SRCS-$(CONFIG_RTE_LIBRTE_FM10K_INC_VECTOR) += fm10k_rxtx_vec.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 94482cf..9237f84 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -115,11 +115,4 @@ endif
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include := rte_pmd_i40e.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/ixgbe/Makefile b/drivers/net/ixgbe/Makefile
index 38b9fbd..f62f3d5 100644
--- a/drivers/net/ixgbe/Makefile
+++ b/drivers/net/ixgbe/Makefile
@@ -124,10 +124,4 @@ endif
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)-include := rte_pmd_ixgbe.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/mlx4/Makefile b/drivers/net/mlx4/Makefile
index 68c5902..d30553e 100644
--- a/drivers/net/mlx4/Makefile
+++ b/drivers/net/mlx4/Makefile
@@ -37,12 +37,6 @@ LIB = librte_pmd_mlx4.a
 # Sources.
 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4.c
 
-# Dependencies.
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_mempool
-
 # Basic CFLAGS.
 CFLAGS += -O3
 CFLAGS += -std=gnu99 -Wall -Wextra
diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index 671089c..d18de6b 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -50,13 +50,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_fdir.c
 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_mr.c
 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_flow.c
 
-# Dependencies.
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_kvargs
-
 # Basic CFLAGS.
 CFLAGS += -O3
 CFLAGS += -std=gnu99 -Wall -Wextra
diff --git a/drivers/net/nfp/Makefile b/drivers/net/nfp/Makefile
index 4cadd13..4ee2c2d 100644
--- a/drivers/net/nfp/Makefile
+++ b/drivers/net/nfp/Makefile
@@ -50,9 +50,4 @@ LIBABIVER := 1
 #
 SRCS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp_net.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/null/Makefile b/drivers/net/null/Makefile
index 0c909c6..40a839f 100644
--- a/drivers/net/null/Makefile
+++ b/drivers/net/null/Makefile
@@ -53,11 +53,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += rte_eth_null.c
 #
 SYMLINK-y-include += rte_eth_null.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/pcap/Makefile b/drivers/net/pcap/Makefile
index 89ac402..7ebd0be 100644
--- a/drivers/net/pcap/Makefile
+++ b/drivers/net/pcap/Makefile
@@ -55,11 +55,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += rte_eth_pcap.c
 #
 SYMLINK-y-include +=
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 29b443d..d989536 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -100,9 +100,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_eth_if.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_rxtx.c
 
-# dependent libs:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/ring/Makefile b/drivers/net/ring/Makefile
index ae83505..b7e1a37 100644
--- a/drivers/net/ring/Makefile
+++ b/drivers/net/ring/Makefile
@@ -53,9 +53,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += rte_eth_ring.c
 #
 SYMLINK-y-include += rte_eth_ring.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/sfc/Makefile b/drivers/net/sfc/Makefile
index 619a0ed..f4d0b61 100644
--- a/drivers/net/sfc/Makefile
+++ b/drivers/net/sfc/Makefile
@@ -133,12 +133,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += ef10_vpd.c
 SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += hunt_nic.c
 SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += medford_nic.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/szedata2/Makefile b/drivers/net/szedata2/Makefile
index 4a7b14c..836c3b2 100644
--- a/drivers/net/szedata2/Makefile
+++ b/drivers/net/szedata2/Makefile
@@ -54,11 +54,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += rte_eth_szedata2.c
 #
 SYMLINK-y-include +=
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile
index e18f30c..bedd1b7 100644
--- a/drivers/net/tap/Makefile
+++ b/drivers/net/tap/Makefile
@@ -47,11 +47,4 @@ CFLAGS += $(WERROR_FLAGS)
 #
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += rte_eth_tap.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/thunderx/Makefile b/drivers/net/thunderx/Makefile
index bcab5f9..706250b 100644
--- a/drivers/net/thunderx/Makefile
+++ b/drivers/net/thunderx/Makefile
@@ -65,8 +65,4 @@ CFLAGS_nicvf_rxtx.o += -fno-prefetch-loop-arrays
 endif
 CFLAGS_nicvf_rxtx.o += -Ofast
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += lib/librte_mempool lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/vhost/Makefile b/drivers/net/vhost/Makefile
index 050c5aa..3ba8ad6 100644
--- a/drivers/net/vhost/Makefile
+++ b/drivers/net/vhost/Makefile
@@ -55,12 +55,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += rte_eth_vhost.c
 #
 SYMLINK-y-include += rte_eth_vhost.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_vhost
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/virtio/Makefile b/drivers/net/virtio/Makefile
index 8b5b5d6..b21b878 100644
--- a/drivers/net/virtio/Makefile
+++ b/drivers/net/virtio/Makefile
@@ -66,10 +66,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_user/virtio_user_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_user_ethdev.c
 endif
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/vmxnet3/Makefile b/drivers/net/vmxnet3/Makefile
index 23ff1da..84356ae 100644
--- a/drivers/net/vmxnet3/Makefile
+++ b/drivers/net/vmxnet3/Makefile
@@ -76,9 +76,4 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3_ethdev.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/xenvirt/Makefile b/drivers/net/xenvirt/Makefile
index 1d05b71..8b4b8f0 100644
--- a/drivers/net/xenvirt/Makefile
+++ b/drivers/net/xenvirt/Makefile
@@ -54,10 +54,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += rte_eth_xenvirt.c rte_mempool_gntalloc.
 #
 SYMLINK-y-include += rte_eth_xenvirt.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += lib/librte_cmdline
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/examples/ethtool/Makefile b/examples/ethtool/Makefile
index 995cd25..30b42b7 100644
--- a/examples/ethtool/Makefile
+++ b/examples/ethtool/Makefile
@@ -46,4 +46,7 @@ else
 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 46b1b3a..197c1d6 100644
--- a/examples/ethtool/lib/Makefile
+++ b/examples/ethtool/lib/Makefile
@@ -58,8 +58,4 @@ ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
 LDLIBS += -lrte_pmd_ixgbe
 endif
 
-# internal dependencies
-DEPDIRS-y += lib/librte_eal
-DEPDIRS-y += lib/librte_ether
-
 include $(RTE_SDK)/mk/rte.extlib.mk
diff --git a/lib/Makefile b/lib/Makefile
index 4178325..d0ea068 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -34,34 +34,68 @@ include $(RTE_SDK)/mk/rte.vars.mk
 DIRS-y += librte_compat
 DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring
+DEPDIRS-librte_ring := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool
+DEPDIRS-librte_mempool := librte_eal librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_MBUF) += librte_mbuf
+DEPDIRS-librte_mbuf := librte_eal librte_mempool
 DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer
+DEPDIRS-librte_timer := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile
+DEPDIRS-librte_cfgfile := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
+DEPDIRS-librte_cmdline := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether
+DEPDIRS-librte_ether := librte_net librte_eal librte_mempool librte_ring
+DEPDIRS-librte_ether += librte_mbuf
 DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += librte_cryptodev
+DEPDIRS-librte_cryptodev := librte_eal librte_mempool librte_ring librte_mbuf
+DEPDIRS-librte_cryptodev += librte_kvargs
 DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost
+DEPDIRS-librte_vhost := librte_eal librte_mempool librte_mbuf librte_ether
 DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash
+DEPDIRS-librte_hash := librte_eal librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_EFD) += librte_efd
+DEPDIRS-librte_efd := librte_eal librte_ring librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_LPM) += librte_lpm
+DEPDIRS-librte_lpm := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_ACL) += librte_acl
+DEPDIRS-librte_acl := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_NET) += librte_net
+DEPDIRS-librte_net := librte_mbuf
 DIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += librte_ip_frag
+DEPDIRS-librte_ip_frag := librte_eal librte_ether librte_hash librte_mbuf
+DEPDIRS-librte_ip_frag += librte_mempool
 DIRS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += librte_jobstats
+DEPDIRS-librte_jobstats := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_POWER) += librte_power
+DEPDIRS-librte_power := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_METER) += librte_meter
+DEPDIRS-librte_meter := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_SCHED) += librte_sched
+DEPDIRS-librte_sched := librte_eal librte_mempool librte_mbuf librte_net
+DEPDIRS-librte_sched += librte_timer
 DIRS-$(CONFIG_RTE_LIBRTE_KVARGS) += librte_kvargs
+DEPDIRS-librte_kvargs := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += librte_distributor
+DEPDIRS-librte_distributor := librte_eal librte_mbuf librte_ether
 DIRS-$(CONFIG_RTE_LIBRTE_PORT) += librte_port
+DEPDIRS-librte_port := librte_eal librte_mbuf librte_mempool librte_ether
+DEPDIRS-librte_port += librte_ip_frag librte_sched librte_kni
 DIRS-$(CONFIG_RTE_LIBRTE_TABLE) += librte_table
+DEPDIRS-librte_table := librte_eal librte_mbuf librte_mempool librte_port
+DEPDIRS-librte_table += librte_lpm librte_acl librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += librte_pipeline
+DEPDIRS-librte_pipeline := librte_eal librte_meter librte_mempool librte_table
+DEPDIRS-librte_pipeline += librte_port
 DIRS-$(CONFIG_RTE_LIBRTE_REORDER) += librte_reorder
+DEPDIRS-librte_reorder := librte_mbuf librte_mempool librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += librte_pdump
+DEPDIRS-librte_pdump := librte_eal librte_mbuf librte_mempool librte_ether
 
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
 DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni
 endif
+DEPDIRS-librte_kni:= librte_eal librte_mbuf librte_mempool librte_ether
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index d05be66..e2dacd6 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -92,7 +92,4 @@ endif
 SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include := rte_acl_osdep.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include += rte_acl.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ACL) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_cfgfile/Makefile b/lib/librte_cfgfile/Makefile
index 616aef0..755ef11 100644
--- a/lib/librte_cfgfile/Makefile
+++ b/lib/librte_cfgfile/Makefile
@@ -51,7 +51,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_CFGFILE) += rte_cfgfile.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_CFGFILE)-include += rte_cfgfile.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index 7d2d148..644f68e 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -61,7 +61,4 @@ INCS += cmdline_parse_etheraddr.h cmdline_parse_string.h cmdline_rdline.h
 INCS += cmdline_vt100.h cmdline_socket.h cmdline_cirbuf.h cmdline_parse_portlist.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_CMDLINE)-include := $(INCS)
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index aebf5d9..18f5e8c 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -52,11 +52,4 @@ SYMLINK-y-include += rte_cryptodev_pmd.h
 # versioning export map
 EXPORT_MAP := rte_cryptodev_version.map
 
-# library dependencies
-DEPDIRS-y += lib/librte_eal
-DEPDIRS-y += lib/librte_mempool
-DEPDIRS-y += lib/librte_ring
-DEPDIRS-y += lib/librte_mbuf
-DEPDIRS-y += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_distributor/Makefile b/lib/librte_distributor/Makefile
index 4c9af17..e3a3a79 100644
--- a/lib/librte_distributor/Makefile
+++ b/lib/librte_distributor/Makefile
@@ -47,8 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) := rte_distributor.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)-include := rte_distributor.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_eal/Makefile b/lib/librte_eal/Makefile
index cf11a09..5690bb4 100644
--- a/lib/librte_eal/Makefile
+++ b/lib/librte_eal/Makefile
@@ -33,6 +33,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 DIRS-y += common
 DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += linuxapp
+DEPDIRS-linuxapp := common
 DIRS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += bsdapp
+DEPDIRS-bsdapp := common
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index cce99f7..16791df 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -111,7 +111,4 @@ INC := rte_interrupts.h
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_BSDAPP)-include/exec-env := \
 	$(addprefix include/exec-env/,$(INC))
 
-DEPDIRS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += lib/librte_eal/common
-DEPDIRS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += lib/librte_eal/common/arch/$(ARCH_DIR)
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_eal/linuxapp/Makefile b/lib/librte_eal/linuxapp/Makefile
index 20d2a91..4794696 100644
--- a/lib/librte_eal/linuxapp/Makefile
+++ b/lib/librte_eal/linuxapp/Makefile
@@ -34,6 +34,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal
 DIRS-$(CONFIG_RTE_EAL_IGB_UIO) += igb_uio
 DIRS-$(CONFIG_RTE_KNI_KMOD) += kni
+DEPDIRS-kni := eal
 DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += xen_dom0
+DEPDIRS-xen_dom0 := eal
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index aa874a5..8624ad2 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -131,7 +131,4 @@ INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUXAPP)-include/exec-env := \
 	$(addprefix include/exec-env/,$(INC))
 
-DEPDIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += lib/librte_eal/common
-DEPDIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += lib/librte_eal/common/arch/$(ARCH_DIR)
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_eal/linuxapp/kni/Makefile b/lib/librte_eal/linuxapp/kni/Makefile
index 7864a2a..154c528 100644
--- a/lib/librte_eal/linuxapp/kni/Makefile
+++ b/lib/librte_eal/linuxapp/kni/Makefile
@@ -53,9 +53,6 @@ UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE $(RTE_KERNELDIR)/include/ge
 MODULE_CFLAGS += -D"UBUNTU_KERNEL_CODE=UBUNTU_KERNEL_VERSION($(UBUNTU_KERNEL_CODE))"
 endif
 
-# this lib needs main eal
-DEPDIRS-y += lib/librte_eal/linuxapp/eal
-
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_eal/linuxapp/xen_dom0/Makefile b/lib/librte_eal/linuxapp/xen_dom0/Makefile
index 9d22fb9..be51a82 100644
--- a/lib/librte_eal/linuxapp/xen_dom0/Makefile
+++ b/lib/librte_eal/linuxapp/xen_dom0/Makefile
@@ -44,9 +44,6 @@ MODULE_CFLAGS += -I$(RTE_OUTPUT)/include
 MODULE_CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h
 MODULE_CFLAGS += -Wall -Werror
 
-# this lib needs main eal
-DEPDIRS-y += lib/librte_eal/linuxapp/eal
-
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_efd/Makefile b/lib/librte_efd/Makefile
index a442c62..b9277bc 100644
--- a/lib/librte_efd/Makefile
+++ b/lib/librte_efd/Makefile
@@ -47,9 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_EFD) := rte_efd.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_EFD)-include := rte_efd.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_EFD) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_EFD) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_EFD) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile
index 1d095a9..066114b 100644
--- a/lib/librte_ether/Makefile
+++ b/lib/librte_ether/Makefile
@@ -55,7 +55,4 @@ SYMLINK-y-include += rte_dev_info.h
 SYMLINK-y-include += rte_flow.h
 SYMLINK-y-include += rte_flow_driver.h
 
-# this lib depends upon:
-DEPDIRS-y += lib/librte_net lib/librte_eal lib/librte_mempool lib/librte_ring lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_hash/Makefile b/lib/librte_hash/Makefile
index bb1ea99..d856aa2 100644
--- a/lib/librte_hash/Makefile
+++ b/lib/librte_hash/Makefile
@@ -55,7 +55,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_jhash.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_thash.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_fbk_hash.h
 
-# this lib needs eal and ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_HASH) += lib/librte_eal lib/librte_ring
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ip_frag/Makefile b/lib/librte_ip_frag/Makefile
index 43f8b1e..4e693bf 100644
--- a/lib/librte_ip_frag/Makefile
+++ b/lib/librte_ip_frag/Makefile
@@ -52,10 +52,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += ip_frag_internal.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_IP_FRAG)-include += rte_ip_frag.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_hash
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mempool
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_jobstats/Makefile b/lib/librte_jobstats/Makefile
index 136a448..561a067 100644
--- a/lib/librte_jobstats/Makefile
+++ b/lib/librte_jobstats/Makefile
@@ -47,7 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_JOBSTATS) := rte_jobstats.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_JOBSTATS)-include := rte_jobstats.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_kni/Makefile b/lib/librte_kni/Makefile
index 0947446..70f1ca8 100644
--- a/lib/librte_kni/Makefile
+++ b/lib/librte_kni/Makefile
@@ -46,9 +46,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_KNI) := rte_kni.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_KNI)-include := rte_kni.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_ether
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
index 87b09f2..564dd31 100644
--- a/lib/librte_kvargs/Makefile
+++ b/lib/librte_kvargs/Makefile
@@ -49,7 +49,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) := rte_kvargs.c
 INCS := rte_kvargs.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_KVARGS)-include := $(INCS)
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KVARGS) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 3dc549d..32be46b 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -55,7 +55,4 @@ else ifeq ($(CONFIG_RTE_ARCH_PPC_64),y)
 SYMLINK-$(CONFIG_RTE_LIBRTE_LPM)-include += rte_lpm_altivec.h
 endif
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_LPM) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 4ae2e8c..956902a 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -46,7 +46,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MBUF) += lib/librte_eal lib/librte_mempool
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
index 057a6ab..96b6ca2 100644
--- a/lib/librte_mempool/Makefile
+++ b/lib/librte_mempool/Makefile
@@ -48,6 +48,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool_stack.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_MEMPOOL)-include := rte_mempool.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += lib/librte_eal lib/librte_ring
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_meter/Makefile b/lib/librte_meter/Makefile
index f07fced..539bfdd 100644
--- a/lib/librte_meter/Makefile
+++ b/lib/librte_meter/Makefile
@@ -53,7 +53,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_METER) := rte_meter.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_METER)-include := rte_meter.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_METER) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 20cf664..abd5c46 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -45,6 +45,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_NET) += lib/librte_eal lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pdump/Makefile b/lib/librte_pdump/Makefile
index 166441a..1c03bcb 100644
--- a/lib/librte_pdump/Makefile
+++ b/lib/librte_pdump/Makefile
@@ -48,10 +48,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PDUMP) := rte_pdump.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_PDUMP)-include := rte_pdump.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += lib/librte_ether
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pipeline/Makefile b/lib/librte_pipeline/Makefile
index 05d64ff..7a835fd 100644
--- a/lib/librte_pipeline/Makefile
+++ b/lib/librte_pipeline/Makefile
@@ -51,11 +51,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := rte_pipeline.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_table
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_port
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile
index 44fa735..76629a1 100644
--- a/lib/librte_port/Makefile
+++ b/lib/librte_port/Makefile
@@ -77,15 +77,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_kni.h
 endif
 SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_source_sink.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) := lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ip_frag
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_sched
-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_kni
-endif
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index cee95cd..06cd10e 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -47,7 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_POWER)-include := rte_power.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_POWER) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_reorder/Makefile b/lib/librte_reorder/Makefile
index 0d111aa..4e44e72 100644
--- a/lib/librte_reorder/Makefile
+++ b/lib/librte_reorder/Makefile
@@ -47,9 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_REORDER) := rte_reorder.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_REORDER)-include := rte_reorder.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_REORDER) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_REORDER) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_REORDER) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
index 4b1112e..3e2f4b8 100644
--- a/lib/librte_ring/Makefile
+++ b/lib/librte_ring/Makefile
@@ -46,6 +46,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_RING) := rte_ring.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_RING)-include := rte_ring.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_RING) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
index 44cb780..18274e7 100644
--- a/lib/librte_sched/Makefile
+++ b/lib/librte_sched/Makefile
@@ -58,9 +58,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_SCHED) += rte_reciprocal.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h rte_bitmap.h rte_sched_common.h rte_red.h rte_approx.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_reciprocal.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_net lib/librte_timer
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_table/Makefile b/lib/librte_table/Makefile
index c82c769..0d06d36 100644
--- a/lib/librte_table/Makefile
+++ b/lib/librte_table/Makefile
@@ -72,15 +72,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_lru.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_array.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_stub.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) := lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_port
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_lpm
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_acl
-endif
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_timer/Makefile b/lib/librte_timer/Makefile
index 2aabef8..03a1539 100644
--- a/lib/librte_timer/Makefile
+++ b/lib/librte_timer/Makefile
@@ -46,7 +46,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_TIMER) := rte_timer.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_TIMER)-include := rte_timer.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TIMER) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
index 415ffc6..1b224b3 100644
--- a/lib/librte_vhost/Makefile
+++ b/lib/librte_vhost/Makefile
@@ -53,11 +53,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c socket.c vhost.c vhost_user.c \
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_virtio_net.h
 
-# dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/mk/internal/rte.depdirs-post.mk b/mk/internal/rte.depdirs-post.mk
deleted file mode 100644
index eb73ad3..0000000
--- a/mk/internal/rte.depdirs-post.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-#   BSD LICENSE
-#
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   All rights reserved.
-#
-#   Redistribution and use in source and binary forms, with or without
-#   modification, are permitted provided that the following conditions
-#   are met:
-#
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in
-#       the documentation and/or other materials provided with the
-#       distribution.
-#     * Neither the name of Intel Corporation nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
-#
-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-.PHONY: depdirs $(DEPDIRS-y)
-depdirs: $(DEPDIRS-y)
-	@echo ""
-
-$(DEPDIRS-y):
-	@$(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $@
-
-.PHONY: depgraph
-depgraph:
-	@for d in $(DEPDIRS-y); do \
-		echo "    \"$(S)\" -> \"$$d\"" ; \
-	done
diff --git a/mk/internal/rte.depdirs-pre.mk b/mk/internal/rte.depdirs-pre.mk
deleted file mode 100644
index 8825db0..0000000
--- a/mk/internal/rte.depdirs-pre.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-#   BSD LICENSE
-#
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   All rights reserved.
-#
-#   Redistribution and use in source and binary forms, with or without
-#   modification, are permitted provided that the following conditions
-#   are met:
-#
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in
-#       the documentation and/or other materials provided with the
-#       distribution.
-#     * Neither the name of Intel Corporation nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
-#
-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# nothing
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 0e0b600..62a2a1a 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -34,7 +34,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -278,7 +277,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 ifneq ($(wildcard $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.app.mk),)
 include $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.app.mk
diff --git a/mk/rte.bsdmodule.mk b/mk/rte.bsdmodule.mk
index 86b92ff..6fc137a 100644
--- a/mk/rte.bsdmodule.mk
+++ b/mk/rte.bsdmodule.mk
@@ -43,7 +43,6 @@ else
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # DPDK uses a more up-to-date gcc, so clear the override here.
 unexport CC
@@ -111,7 +110,6 @@ doclean:
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.extsubdir.mk b/mk/rte.extsubdir.mk
index f50f006..3e733d8 100644
--- a/mk/rte.extsubdir.mk
+++ b/mk/rte.extsubdir.mk
@@ -30,6 +30,8 @@
 
 MAKEFLAGS += --no-print-directory
 
+ALL_DEPDIRS := $(patsubst DEPDIRS-%,%,$(filter DEPDIRS-%,$(.VARIABLES)))
+
 # output directory
 O ?= .
 BASE_OUTPUT ?= $(O)
@@ -50,4 +52,16 @@ $(DIRS-y):
 		BASE_OUTPUT=$(BASE_OUTPUT) \
 		CUR_SUBDIR=$(CUR_SUBDIR)/$(@) \
 		S=$(CURDIR)/$(@) \
+		DEPDIRS="$(DEPDIRS-$@)" \
 		$(filter-out $(DIRS-y),$(MAKECMDGOALS))
+
+define depdirs_rule
+$(DEPDIRS-$(1)):
+
+$(1): | $(DEPDIRS-$(1))
+
+$(if $(D),$(info $(1) depends on $(DEPDIRS-$(1))))
+endef
+
+$(foreach dir,$(ALL_DEPDIRS),\
+	$(eval $(call depdirs_rule,$(dir))))
diff --git a/mk/rte.gnuconfigure.mk b/mk/rte.gnuconfigure.mk
index 65b658c..b5c8df0 100644
--- a/mk/rte.gnuconfigure.mk
+++ b/mk/rte.gnuconfigure.mk
@@ -32,7 +32,6 @@
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -68,7 +67,6 @@ doclean:
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk
index 07b391c..5cb4909 100644
--- a/mk/rte.hostapp.mk
+++ b/mk/rte.hostapp.mk
@@ -35,7 +35,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -117,7 +116,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.hostlib.mk b/mk/rte.hostlib.mk
index fe24049..7709cff 100644
--- a/mk/rte.hostlib.mk
+++ b/mk/rte.hostlib.mk
@@ -35,7 +35,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -110,7 +109,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.install.mk b/mk/rte.install.mk
index e7ac4d5..96144fb 100644
--- a/mk/rte.install.mk
+++ b/mk/rte.install.mk
@@ -33,7 +33,6 @@
 
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -55,4 +54,3 @@ doclean:
 
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index 5b72475..bc2f2fb 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -33,7 +33,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 EXTLIB_BUILD ?= n
 
@@ -85,12 +84,12 @@ else
 _CPU_LDFLAGS := $(CPU_LDFLAGS)
 endif
 
-# Translate DEPDIRS-y into LDLIBS
+# Translate DEPDIRS into LDLIBS
 # Ignore (sub)directory dependencies which do not provide an actual library
-_IGNORE_DIRS = lib/librte_eal/% lib/librte_compat
-_DEPDIRS = $(filter-out $(_IGNORE_DIRS),$(DEPDIRS-y))
+_IGNORE_DIRS = librte_eal/% librte_compat
+_DEPDIRS = $(filter-out $(_IGNORE_DIRS),$(DEPDIRS))
 _LDDIRS = $(subst librte_ether,librte_ethdev,$(_DEPDIRS))
-LDLIBS += $(subst lib/lib,-l,$(_LDDIRS))
+LDLIBS += $(subst lib,-l,$(_LDDIRS))
 
 O_TO_A = $(AR) crDs $(LIB) $(OBJS-y)
 O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight
@@ -183,7 +182,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.module.mk b/mk/rte.module.mk
index 53ed4fe..3dd9ac7 100644
--- a/mk/rte.module.mk
+++ b/mk/rte.module.mk
@@ -43,7 +43,6 @@ else
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -108,7 +107,6 @@ doclean:
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.obj.mk b/mk/rte.obj.mk
index 5982227..9336d5f 100644
--- a/mk/rte.obj.mk
+++ b/mk/rte.obj.mk
@@ -33,7 +33,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -106,7 +105,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.sdkbuild.mk b/mk/rte.sdkbuild.mk
index 02ff35b..0bf909e 100644
--- a/mk/rte.sdkbuild.mk
+++ b/mk/rte.sdkbuild.mk
@@ -38,18 +38,10 @@ else
   include $(RTE_SDK)/mk/rte.vars.mk
 endif
 
-#
-# include .depdirs and define rules to order priorities between build
-# of directories.
-#
--include $(RTE_OUTPUT)/.depdirs
-
-define depdirs_rule
-$(1): $(sort $(LOCAL_DEPDIRS-$(1)))
-endef
-
-$(foreach d,$(ROOTDIRS-y) $(ROOTDIRS-),$(eval $(call depdirs_rule,$(d))))
-drivers: | buildtools
+buildtools: | lib
+drivers: | lib buildtools
+app: | lib buildtools drivers
+test: | lib buildtools drivers
 
 #
 # build and clean targets
@@ -93,8 +85,8 @@ $(ROOTDIRS-y) $(ROOTDIRS-):
 
 RTE_MAKE_SUBTARGET ?= all
 
-%_sub: $(addsuffix _sub,$(FULL_DEPDIRS-$(*)))
-	@echo $(addsuffix _sub,$(FULL_DEPDIRS-$(*)))
+%_sub: $(addsuffix _sub,$(*))
+	@echo $(addsuffix _sub,$(*))
 	@[ -d $(BUILDDIR)/$* ] || mkdir -p $(BUILDDIR)/$*
 	@echo "== Build $*"
 	$(Q)$(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* \
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index 97581c9..1f2d6bd 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -69,7 +69,6 @@ ifeq ($(RTE_CONFIG_TEMPLATE),)
 config: notemplate
 else
 config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
-	$(Q)$(MAKE) depdirs
 	@echo "Configuration done"
 endif
 
@@ -140,7 +139,6 @@ checkconfig:
 	fi
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk \
 		headerconfig NODOTCONF=1
-	$(Q)$(MAKE) -s depdirs
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.sdkdepdirs.mk b/mk/rte.sdkdepdirs.mk
index 1d4b12f..1f27697 100644
--- a/mk/rte.sdkdepdirs.mk
+++ b/mk/rte.sdkdepdirs.mk
@@ -35,29 +35,3 @@ endif
 ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile))
   $(error "need a make config first")
 endif
-
-DEPDIR_FILES = $(addsuffix /.depdirs, $(addprefix $(BUILDDIR)/,$(ROOTDIRS-y) $(ROOTDIRS-)))
-
-.PHONY: depdirs
-depdirs: $(RTE_OUTPUT)/.depdirs
-$(RTE_OUTPUT)/.depdirs: $(DEPDIR_FILES)
-	@rm -f $@
-	@sort -u -o $@ $(DEPDIR_FILES)
-
-$(DEPDIR_FILES): $(RTE_OUTPUT)/.config
-	@dir=$(notdir $(@D)); \
-	[ -d $(BUILDDIR)/$$dir ] || mkdir -p $(BUILDDIR)/$$dir; \
-	$(MAKE) S=$$dir -f $(RTE_SRCDIR)/$$dir/Makefile depdirs > $@
-
-.PHONY: depgraph
-depgraph:
-	@echo "digraph unix {" ; \
-	echo "    size=\"6,6\";" ; \
-	echo "    node [color=lightblue2, style=filled];" ; \
-	for d in $(ROOTDIRS-y); do \
-		echo "    \"root\" -> \"$$d\"" ; \
-		if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \
-			$(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depgraph ; \
-		fi ; \
-	done ; \
-	echo "}"
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index f20563e..685d2f5 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -111,10 +111,6 @@ help: doc-help
 doc-%:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkdoc.mk $*
 
-.PHONY: depdirs depgraph
-depdirs depgraph:
-	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkdepdirs.mk $@
-
 .PHONY: gcov gcovclean
 gcov gcovclean:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkgcov.mk $@
diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk
index fc6b0b4..87ccf0b 100644
--- a/mk/rte.shared.mk
+++ b/mk/rte.shared.mk
@@ -32,7 +32,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -131,7 +130,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.subdir.mk b/mk/rte.subdir.mk
index 5341f1f..364b80e 100644
--- a/mk/rte.subdir.mk
+++ b/mk/rte.subdir.mk
@@ -37,6 +37,8 @@ include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
 
+ALL_DEPDIRS := $(patsubst DEPDIRS-%,%,$(filter DEPDIRS-%,$(.VARIABLES)))
+
 CLEANDIRS = $(addsuffix _clean,$(DIRS-y) $(DIRS-n) $(DIRS-))
 
 VPATH += $(SRCDIR)
@@ -59,8 +61,9 @@ build: _postbuild
 .PHONY: $(DIRS-y)
 $(DIRS-y):
 	@[ -d $(CURDIR)/$@ ] || mkdir -p $(CURDIR)/$@
-	@echo "== Build $S/$@"
-	@$(MAKE) S=$S/$@ -f $(SRCDIR)/$@/Makefile -C $(CURDIR)/$@ all
+	@echo "== Build $S/$@ "
+	@$(MAKE) S=$S/$@ -f $(SRCDIR)/$@/Makefile -C $(CURDIR)/$@ \
+		DEPDIRS="$(DEPDIRS-$@)" all
 
 .PHONY: clean
 clean: _postclean
@@ -72,34 +75,16 @@ clean: _postclean
 	fi
 	@rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS)
 
-#
-# include .depdirs and define rules to order priorities between build
-# of directories.
-#
--include $(RTE_OUTPUT)/.depdirs
-
 define depdirs_rule
-$(1): $(sort $(patsubst $(S)/%,%,$(LOCAL_DEPDIRS-$(S)/$(1))))
-endef
-
-$(foreach d,$(DIRS-y),$(eval $(call depdirs_rule,$(d))))
+$(DEPDIRS-$(1)):
 
-DEPDIRS = $(wildcard $(addprefix $(S)/,$(DIRS-y)))
+$(1): | $(DEPDIRS-$(1))
 
-.PHONY: depdirs $(DEPDIRS)
-depdirs: $(DEPDIRS)
-
-$(DEPDIRS):
-	@$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile depdirs
+$(if $(D),$(info $(1) depends on $(DEPDIRS-$(1))))
+endef
 
-.PHONY: depgraph
-depgraph:
-	@for d in $(DIRS-y); do \
-		echo "    \"$(S)\" -> \"$(S)/$$d\"" ; \
-		if [ -f $(SRCDIR)/$$d/Makefile ]; then \
-			$(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depgraph ; \
-		fi ; \
-	done
+$(foreach dir,$(ALL_DEPDIRS),\
+	$(eval $(call depdirs_rule,$(dir))))
 
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
diff --git a/test/cmdline_test/Makefile b/test/cmdline_test/Makefile
index c6169f5..e9eafd2 100644
--- a/test/cmdline_test/Makefile
+++ b/test/cmdline_test/Makefile
@@ -47,9 +47,6 @@ SRCS-y += commands.c
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
-# this application needs libraries first
-DEPDIRS-y += lib drivers
-
 include $(RTE_SDK)/mk/rte.app.mk
 
 endif
diff --git a/test/test-acl/Makefile b/test/test-acl/Makefile
index 43dfdcb..899a287 100644
--- a/test/test-acl/Makefile
+++ b/test/test-acl/Makefile
@@ -41,7 +41,6 @@ CFLAGS += $(WERROR_FLAGS)
 SRCS-y := main.c
 
 # this application needs libraries first
-DEPDIRS-y += lib
 
 include $(RTE_SDK)/mk/rte.app.mk
 
diff --git a/test/test-pipeline/Makefile b/test/test-pipeline/Makefile
index 4bab6dc..520a319 100644
--- a/test/test-pipeline/Makefile
+++ b/test/test-pipeline/Makefile
@@ -56,9 +56,6 @@ SRCS-y += pipeline_lpm_ipv6.c
 # include ACL lib if available
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += pipeline_acl.c
 
-# this application needs libraries first
-DEPDIRS-y += lib drivers
-
 include $(RTE_SDK)/mk/rte.app.mk
 
 endif
diff --git a/test/test/Makefile b/test/test/Makefile
index 1a5e03d..79f0c61 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -214,9 +214,6 @@ CFLAGS_test_memcpy_perf.o += -fno-var-tracking-assignments
 endif
 endif
 
-# this application needs libraries first
-DEPDIRS-y += lib drivers
-
 # Link against shared libraries when needed
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
 ifneq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
-- 
2.8.1

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-03-17 17:13     ` Olivier Matz
@ 2017-03-17 17:47       ` Robin Jarry
  2017-03-20  8:31         ` Olivier Matz
  2017-03-24 13:21       ` [dpdk-dev] [PATCH v2] " Olivier Matz
  1 sibling, 1 reply; 38+ messages in thread
From: Robin Jarry @ 2017-03-17 17:47 UTC (permalink / raw)
  To: Olivier MATZ; +Cc: Ferruh Yigit, Thomas Monjalon, dev, keith.wiles, jerin.jacob

Hi Olivier,

Thanks again for this. I only have minor cosmetic remarks:

Le 17 mars 2017 18:13, "Olivier Matz" <olivier.matz@6wind.com> a écrit:
> diff --git a/app/pdump/Makefile b/app/pdump/Makefile
> index 536198f..8ec6bd6 100644
> --- a/app/pdump/Makefile
> +++ b/app/pdump/Makefile
> @@ -42,7 +42,6 @@ CFLAGS += $(WERROR_FLAGS)
>  SRCS-y := main.c
>
>  # this application needs libraries first
> -DEPDIRS-y += lib
>
>  include $(RTE_SDK)/mk/rte.app.mk

Maybe remove the comment line too?

> diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
> index eec1ed0..3be1ae8 100644
> --- a/app/test-pmd/Makefile
> +++ b/app/test-pmd/Makefile
> @@ -82,7 +82,6 @@ endif
>  CFLAGS_cmdline.o := -D_GNU_SOURCE
>
>  # this application needs libraries first
> -DEPDIRS-y += lib drivers
>
>  include $(RTE_SDK)/mk/rte.app.mk

Same here. There may be others.

> --- a/mk/rte.subdir.mk
> +++ b/mk/rte.subdir.mk
> @@ -59,8 +61,9 @@ build: _postbuild
>  .PHONY: $(DIRS-y)
>  $(DIRS-y):
>         @[ -d $(CURDIR)/$@ ] || mkdir -p $(CURDIR)/$@
> -       @echo "== Build $S/$@"
> +       @echo "== Build $S/$@ "

Why change this line ?

Robin

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

* Re: [dpdk-dev] [PATCH] mk: optimize directory dependencies
  2017-03-17 17:47       ` Robin Jarry
@ 2017-03-20  8:31         ` Olivier Matz
  0 siblings, 0 replies; 38+ messages in thread
From: Olivier Matz @ 2017-03-20  8:31 UTC (permalink / raw)
  To: Robin Jarry; +Cc: Ferruh Yigit, Thomas Monjalon, dev, keith.wiles, jerin.jacob

Hi Robin,

On Fri, 17 Mar 2017 18:47:20 +0100, Robin Jarry <robin.jarry@6wind.com> wrote:
> Hi Olivier,
> 
> Thanks again for this. I only have minor cosmetic remarks:
> 
> Le 17 mars 2017 18:13, "Olivier Matz" <olivier.matz@6wind.com> a écrit:
> > diff --git a/app/pdump/Makefile b/app/pdump/Makefile
> > index 536198f..8ec6bd6 100644
> > --- a/app/pdump/Makefile
> > +++ b/app/pdump/Makefile
> > @@ -42,7 +42,6 @@ CFLAGS += $(WERROR_FLAGS)
> >  SRCS-y := main.c
> >
> >  # this application needs libraries first
> > -DEPDIRS-y += lib
> >
> >  include $(RTE_SDK)/mk/rte.app.mk  
> 
> Maybe remove the comment line too?
>
> > diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
> > index eec1ed0..3be1ae8 100644
> > --- a/app/test-pmd/Makefile
> > +++ b/app/test-pmd/Makefile
> > @@ -82,7 +82,6 @@ endif
> >  CFLAGS_cmdline.o := -D_GNU_SOURCE
> >
> >  # this application needs libraries first
> > -DEPDIRS-y += lib drivers
> >
> >  include $(RTE_SDK)/mk/rte.app.mk  
> 
> Same here. There may be others.

Thanks, I'll check for other occurrences.


> > --- a/mk/rte.subdir.mk
> > +++ b/mk/rte.subdir.mk
> > @@ -59,8 +61,9 @@ build: _postbuild
> >  .PHONY: $(DIRS-y)
> >  $(DIRS-y):
> >         @[ -d $(CURDIR)/$@ ] || mkdir -p $(CURDIR)/$@
> > -       @echo "== Build $S/$@"
> > +       @echo "== Build $S/$@ "  
> 
> Why change this line ?

It's a typo, I'll remove it in v2.

Thanks for your review
Olivier

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

* [dpdk-dev] [PATCH v2] mk: optimize directory dependencies
  2017-03-17 17:13     ` Olivier Matz
  2017-03-17 17:47       ` Robin Jarry
@ 2017-03-24 13:21       ` Olivier Matz
  2017-03-27 21:33         ` Thomas Monjalon
  2017-03-28 10:34         ` Ferruh Yigit
  1 sibling, 2 replies; 38+ messages in thread
From: Olivier Matz @ 2017-03-24 13:21 UTC (permalink / raw)
  To: dev; +Cc: thomas.monjalon, ferruh.yigit, robin.jarry, jerin.jacob, keith.wiles

Before this patch, the management of dependencies between directories
had several issues:

- the generation of .depdirs, done at configuration is slow: it can take
  more than one minute on some slow targets (usually ~10s on a standard
  PC without -j).

- for instance, it is possible to express a dependency like:
  - app/foo depends on lib/librte_foo
  - and lib/librte_foo depends on app/bar
  But this won't work because the directories are traversed with a
  depth-first algorithm, so we have to choose between doing 'app' before
  or after 'lib'.

- the script depdirs-rule.sh is too complex.

- we cannot use "make -d" for debug, because the output of make is used for
  the generation of .depdirs.

This patch moves the DEPDIRS-* variables in the upper Makefile, making
the dependencies much easier to calculate. A DEPDIRS variable is still
used to process library dependencies in LDLIBS.

After this commit, "make config" is almost immediate.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Robin Jarry <robin.jarry@6wind.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---

v1 -> v2:
- remove invalid comments in app and test makefiles
- remove additional space in rte.subdir.mk

RFC -> v1:
- rebase on top of current master
- interleave DIRS-* and DEPDIRS-* targets for more readability


 MAINTAINERS                                      |  1 -
 app/pdump/Makefile                               |  3 -
 app/proc_info/Makefile                           |  3 -
 app/test-crypto-perf/Makefile                    |  3 -
 app/test-pmd/Makefile                            |  3 -
 buildtools/depdirs-rule.sh                       | 95 ------------------------
 buildtools/pmdinfogen/Makefile                   |  2 -
 devtools/test-build.sh                           |  2 +-
 doc/guides/prog_guide/dev_kit_build_system.rst   |  2 +-
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 28 -------
 drivers/crypto/Makefile                          | 12 +++
 drivers/crypto/aesni_gcm/Makefile                |  7 --
 drivers/crypto/aesni_mb/Makefile                 |  7 --
 drivers/crypto/armv8/Makefile                    |  7 --
 drivers/crypto/kasumi/Makefile                   |  7 --
 drivers/crypto/null/Makefile                     |  7 --
 drivers/crypto/openssl/Makefile                  |  7 --
 drivers/crypto/qat/Makefile                      |  7 --
 drivers/crypto/scheduler/Makefile                |  8 --
 drivers/crypto/snow3g/Makefile                   |  7 --
 drivers/crypto/zuc/Makefile                      |  7 --
 drivers/net/Makefile                             | 29 ++++++++
 drivers/net/af_packet/Makefile                   |  7 --
 drivers/net/bnx2x/Makefile                       |  4 -
 drivers/net/bnxt/Makefile                        |  6 --
 drivers/net/bonding/Makefile                     |  9 ---
 drivers/net/cxgbe/Makefile                       |  5 --
 drivers/net/e1000/Makefile                       |  5 --
 drivers/net/ena/Makefile                         |  5 --
 drivers/net/enic/Makefile                        |  6 --
 drivers/net/fm10k/Makefile                       |  6 --
 drivers/net/i40e/Makefile                        |  7 --
 drivers/net/ixgbe/Makefile                       |  6 --
 drivers/net/mlx4/Makefile                        |  6 --
 drivers/net/mlx5/Makefile                        |  7 --
 drivers/net/nfp/Makefile                         |  5 --
 drivers/net/null/Makefile                        |  7 --
 drivers/net/pcap/Makefile                        |  7 --
 drivers/net/qede/Makefile                        |  5 --
 drivers/net/ring/Makefile                        |  5 --
 drivers/net/sfc/Makefile                         |  8 --
 drivers/net/szedata2/Makefile                    |  7 --
 drivers/net/tap/Makefile                         |  7 --
 drivers/net/thunderx/Makefile                    |  4 -
 drivers/net/vhost/Makefile                       |  8 --
 drivers/net/virtio/Makefile                      |  6 --
 drivers/net/vmxnet3/Makefile                     |  5 --
 drivers/net/xenvirt/Makefile                     |  6 --
 examples/ethtool/Makefile                        |  3 +
 examples/ethtool/lib/Makefile                    |  4 -
 lib/Makefile                                     | 34 +++++++++
 lib/librte_acl/Makefile                          |  3 -
 lib/librte_cfgfile/Makefile                      |  3 -
 lib/librte_cmdline/Makefile                      |  3 -
 lib/librte_cryptodev/Makefile                    |  7 --
 lib/librte_distributor/Makefile                  |  4 -
 lib/librte_eal/Makefile                          |  2 +
 lib/librte_eal/bsdapp/eal/Makefile               |  3 -
 lib/librte_eal/linuxapp/Makefile                 |  2 +
 lib/librte_eal/linuxapp/eal/Makefile             |  3 -
 lib/librte_eal/linuxapp/kni/Makefile             |  3 -
 lib/librte_eal/linuxapp/xen_dom0/Makefile        |  3 -
 lib/librte_efd/Makefile                          |  5 --
 lib/librte_ether/Makefile                        |  3 -
 lib/librte_hash/Makefile                         |  3 -
 lib/librte_ip_frag/Makefile                      |  6 --
 lib/librte_jobstats/Makefile                     |  3 -
 lib/librte_kni/Makefile                          |  5 --
 lib/librte_kvargs/Makefile                       |  3 -
 lib/librte_lpm/Makefile                          |  3 -
 lib/librte_mbuf/Makefile                         |  3 -
 lib/librte_mempool/Makefile                      |  2 -
 lib/librte_meter/Makefile                        |  3 -
 lib/librte_net/Makefile                          |  2 -
 lib/librte_pdump/Makefile                        |  6 --
 lib/librte_pipeline/Makefile                     |  7 --
 lib/librte_port/Makefile                         | 11 ---
 lib/librte_power/Makefile                        |  3 -
 lib/librte_reorder/Makefile                      |  5 --
 lib/librte_ring/Makefile                         |  2 -
 lib/librte_sched/Makefile                        |  5 --
 lib/librte_table/Makefile                        | 11 ---
 lib/librte_timer/Makefile                        |  3 -
 lib/librte_vhost/Makefile                        |  7 --
 mk/internal/rte.depdirs-post.mk                  | 43 -----------
 mk/internal/rte.depdirs-pre.mk                   | 32 --------
 mk/rte.app.mk                                    |  2 -
 mk/rte.bsdmodule.mk                              |  2 -
 mk/rte.extsubdir.mk                              | 14 ++++
 mk/rte.gnuconfigure.mk                           |  2 -
 mk/rte.hostapp.mk                                |  2 -
 mk/rte.hostlib.mk                                |  2 -
 mk/rte.install.mk                                |  2 -
 mk/rte.lib.mk                                    | 10 +--
 mk/rte.module.mk                                 |  2 -
 mk/rte.obj.mk                                    |  2 -
 mk/rte.sdkbuild.mk                               | 20 ++---
 mk/rte.sdkconfig.mk                              |  2 -
 mk/rte.sdkdepdirs.mk                             | 26 -------
 mk/rte.sdkroot.mk                                |  4 -
 mk/rte.shared.mk                                 |  2 -
 mk/rte.subdir.mk                                 | 35 +++------
 test/cmdline_test/Makefile                       |  3 -
 test/test-acl/Makefile                           |  3 -
 test/test-pipeline/Makefile                      |  3 -
 test/test/Makefile                               |  3 -
 106 files changed, 118 insertions(+), 689 deletions(-)
 delete mode 100755 buildtools/depdirs-rule.sh
 delete mode 100644 mk/internal/rte.depdirs-post.mk
 delete mode 100644 mk/internal/rte.depdirs-pre.mk

diff --git a/MAINTAINERS b/MAINTAINERS
index 0c78b589a..0b1524d3c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -57,7 +57,6 @@ F: config/
 F: mk/
 F: pkg/
 F: buildtools/auto-config-h.sh
-F: buildtools/depdirs-rule.sh
 F: buildtools/gen-build-mk.sh
 F: buildtools/gen-config-h.sh
 F: buildtools/relpath.sh
diff --git a/app/pdump/Makefile b/app/pdump/Makefile
index 536198faf..38ac3e9aa 100644
--- a/app/pdump/Makefile
+++ b/app/pdump/Makefile
@@ -41,9 +41,6 @@ CFLAGS += $(WERROR_FLAGS)
 
 SRCS-y := main.c
 
-# this application needs libraries first
-DEPDIRS-y += lib
-
 include $(RTE_SDK)/mk/rte.app.mk
 
 endif
diff --git a/app/proc_info/Makefile b/app/proc_info/Makefile
index e051e0323..9e90438eb 100644
--- a/app/proc_info/Makefile
+++ b/app/proc_info/Makefile
@@ -39,7 +39,4 @@ CFLAGS += $(WERROR_FLAGS)
 
 SRCS-y := main.c
 
-# this application needs libraries first
-DEPDIRS-y += lib
-
 include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-crypto-perf/Makefile b/app/test-crypto-perf/Makefile
index 276ba68eb..5120b88b6 100644
--- a/app/test-crypto-perf/Makefile
+++ b/app/test-crypto-perf/Makefile
@@ -44,7 +44,4 @@ SRCS-y += cperf_test_throughput.c
 SRCS-y += cperf_test_latency.c
 SRCS-y += cperf_test_vector_parsing.c
 
-# this application needs libraries first
-DEPDIRS-y += lib
-
 include $(RTE_SDK)/mk/rte.app.mk
diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index eec1ed077..35ecee9f6 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -81,9 +81,6 @@ endif
 
 CFLAGS_cmdline.o := -D_GNU_SOURCE
 
-# this application needs libraries first
-DEPDIRS-y += lib drivers
-
 include $(RTE_SDK)/mk/rte.app.mk
 
 endif
diff --git a/buildtools/depdirs-rule.sh b/buildtools/depdirs-rule.sh
deleted file mode 100755
index 7aba08859..000000000
--- a/buildtools/depdirs-rule.sh
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/sh
-
-#   BSD LICENSE
-#
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   All rights reserved.
-#
-#   Redistribution and use in source and binary forms, with or without
-#   modification, are permitted provided that the following conditions
-#   are met:
-#
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in
-#       the documentation and/or other materials provided with the
-#       distribution.
-#     * Neither the name of Intel Corporation nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
-#
-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#
-# This (obscure) bash script finds the smallest different path between
-# path1 and path2 given as command line argument. The given paths MUST
-# be relative paths, the script is not designed to work with absolute
-# paths.
-#
-# The script will then generate Makefile code that can be saved in a
-# file and included in build system.
-#
-# For instance:
-#   depdirs-rule.sh a/b/c/d a/b/e/f
-# Will print:
-#   FULL_DEPDIRS-a/b/c/d += a/b/e/f
-#   LOCAL_DEPDIRS-a/b/c += a/b/e
-#
-# The script returns 0 except if invalid arguments are given.
-#
-
-if [ $# -ne 2 ]; then
-	echo "Bad arguments"
-	echo "Usage:"
-	echo "  $0 path1 path2"
-	exit 1
-fi
-
-left1=${1%%/*}
-right1=${1#*/}
-prev_right1=$1
-prev_left1=
-
-left2=${2%%/*}
-right2=${2#*/}
-prev_right2=$2
-prev_left2=
-
-while [ "${right1}" != "" -a "${right2}" != "" ]; do
-
-	if [ "$left1" != "$left2" ]; then
-		break
-	fi
-
-	prev_left1=$left1
-	left1=$left1/${right1%%/*}
-	prev_right1=$right1
-	right1=${prev_right1#*/}
-	if [ "$right1" = "$prev_right1" ]; then
-		right1=""
-	fi
-
-	prev_left2=$left2
-	left2=$left2/${right2%%/*}
-	prev_right2=$right2
-	right2=${prev_right2#*/}
-	if [ "$right2" = "$prev_right2" ]; then
-		right2=""
-	fi
-done
-
-echo FULL_DEPDIRS-$1 += $2
-echo LOCAL_DEPDIRS-$left1 += $left2
-
-exit 0
diff --git a/buildtools/pmdinfogen/Makefile b/buildtools/pmdinfogen/Makefile
index bd8f9005e..bf07b6f2e 100644
--- a/buildtools/pmdinfogen/Makefile
+++ b/buildtools/pmdinfogen/Makefile
@@ -44,6 +44,4 @@ SRCS-y += pmdinfogen.c
 HOST_CFLAGS += $(WERROR_FLAGS) -g
 HOST_CFLAGS += -I$(RTE_OUTPUT)/include
 
-DEPDIRS-y += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.hostapp.mk
diff --git a/devtools/test-build.sh b/devtools/test-build.sh
index 84d3165e2..5fed4c1b2 100755
--- a/devtools/test-build.sh
+++ b/devtools/test-build.sh
@@ -146,7 +146,7 @@ config () # <directory> <target> <options>
 	fi
 	if [ ! -e $1/.config ] || $reconfig ; then
 		echo "================== Configure $1"
-		make -j$J T=$2 O=$1 config
+		make T=$2 O=$1 config
 
 		echo 'Customize configuration'
 		# Built-in options (lowercase)
diff --git a/doc/guides/prog_guide/dev_kit_build_system.rst b/doc/guides/prog_guide/dev_kit_build_system.rst
index 19de15636..ad032c5f9 100644
--- a/doc/guides/prog_guide/dev_kit_build_system.rst
+++ b/doc/guides/prog_guide/dev_kit_build_system.rst
@@ -367,7 +367,7 @@ Variables that Can be Set/Overridden in a Makefile Only
 
 *   POSTCLEAN: A list of actions to be taken after cleaning. The user should use += to append data in this variable.
 
-*   DEPDIR-y: Only used in the development kit framework to specify if the build of the current directory depends on build of another one.
+*   DEPDIRS-$(DIR): Only used in the development kit framework to specify if the build of the current directory depends on build of another one.
     This is needed to support parallel builds correctly.
 
 Variables that can be Set/Overridden by the User on the Command Line Only
diff --git a/doc/guides/prog_guide/dev_kit_root_make_help.rst b/doc/guides/prog_guide/dev_kit_root_make_help.rst
index fb3520e13..d7c410641 100644
--- a/doc/guides/prog_guide/dev_kit_root_make_help.rst
+++ b/doc/guides/prog_guide/dev_kit_root_make_help.rst
@@ -152,34 +152,6 @@ Documentation Targets
 
     Generate the guides documentation in pdf.
 
-
-Deps Targets
-------------
-
-*   depdirs
-
-    This target is implicitly called by make config.
-    Typically, there is no need for a user to call it,
-    except if DEPDIRS-y variables have been updated in Makefiles.
-    It will generate the file  $(RTE_OUTPUT)/.depdirs.
-
-    Example:
-
-    .. code-block:: console
-
-        make depdirs O=mybuild
-
-*   depgraph
-
-    This command generates a dot graph of dependencies.
-    It can be displayed to debug circular dependency issues, or just to understand the dependencies.
-
-    Example:
-
-    .. code-block:: console
-
-        make depgraph O=mybuild > /tmp/graph.dot && dotty /tmp/ graph.dot
-
 Misc Targets
 ------------
 
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile
index a5a246b31..652c55471 100644
--- a/drivers/crypto/Makefile
+++ b/drivers/crypto/Makefile
@@ -31,15 +31,27 @@
 
 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)
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/crypto/aesni_gcm/Makefile b/drivers/crypto/aesni_gcm/Makefile
index fb17fbf6a..59a7c6a97 100644
--- a/drivers/crypto/aesni_gcm/Makefile
+++ b/drivers/crypto/aesni_gcm/Makefile
@@ -56,11 +56,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm_pmd_ops.c
 # export include files
 SYMLINK-y-include +=
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/aesni_mb/Makefile b/drivers/crypto/aesni_mb/Makefile
index d3994cc63..611d4123b 100644
--- a/drivers/crypto/aesni_mb/Makefile
+++ b/drivers/crypto/aesni_mb/Makefile
@@ -58,11 +58,4 @@ LDLIBS += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += rte_aesni_mb_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/armv8/Makefile b/drivers/crypto/armv8/Makefile
index 2003ec4ed..1474951c7 100644
--- a/drivers/crypto/armv8/Makefile
+++ b/drivers/crypto/armv8/Makefile
@@ -62,11 +62,4 @@ LDLIBS += -L$(ARMV8_CRYPTO_LIB_PATH) -larmv8_crypto
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += rte_armv8_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += rte_armv8_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/kasumi/Makefile b/drivers/crypto/kasumi/Makefile
index 9fb0be857..b47cda0c5 100644
--- a/drivers/crypto/kasumi/Makefile
+++ b/drivers/crypto/kasumi/Makefile
@@ -59,11 +59,4 @@ LDLIBS += -L$(LIBSSO_KASUMI_PATH)/build -lsso_kasumi
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += rte_kasumi_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_KASUMI) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/null/Makefile b/drivers/crypto/null/Makefile
index c143929fc..bc2724b39 100644
--- a/drivers/crypto/null/Makefile
+++ b/drivers/crypto/null/Makefile
@@ -51,11 +51,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += null_crypto_pmd_ops.c
 # export include files
 SYMLINK-y-include +=
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/openssl/Makefile b/drivers/crypto/openssl/Makefile
index 8c4250c8a..e5fdfb59b 100644
--- a/drivers/crypto/openssl/Makefile
+++ b/drivers/crypto/openssl/Makefile
@@ -50,11 +50,4 @@ LDLIBS += -lcrypto
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += rte_openssl_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += rte_openssl_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/qat/Makefile b/drivers/crypto/qat/Makefile
index 20a70d4a5..7322ffe4a 100644
--- a/drivers/crypto/qat/Makefile
+++ b/drivers/crypto/qat/Makefile
@@ -56,11 +56,4 @@ SYMLINK-y-include +=
 # versioning export map
 EXPORT_MAP := rte_pmd_qat_version.map
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += lib/librte_cryptodev
-
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/scheduler/Makefile b/drivers/crypto/scheduler/Makefile
index 0cce6f266..187d3b624 100644
--- a/drivers/crypto/scheduler/Makefile
+++ b/drivers/crypto/scheduler/Makefile
@@ -55,12 +55,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler_pmd_ops.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += rte_cryptodev_scheduler.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler_roundrobin.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_cryptodev
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_reorder
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/snow3g/Makefile b/drivers/crypto/snow3g/Makefile
index bea6760b3..ecee80dfb 100644
--- a/drivers/crypto/snow3g/Makefile
+++ b/drivers/crypto/snow3g/Makefile
@@ -59,11 +59,4 @@ LDLIBS += -L$(LIBSSO_SNOW3G_PATH)/build -lsso_snow3g
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += rte_snow3g_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/crypto/zuc/Makefile b/drivers/crypto/zuc/Makefile
index b15eb0f6f..f543b4073 100644
--- a/drivers/crypto/zuc/Makefile
+++ b/drivers/crypto/zuc/Makefile
@@ -59,11 +59,4 @@ LDLIBS += -L$(LIBSSO_ZUC_PATH)/build -lsso_zuc
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += rte_zuc_pmd_ops.c
 
-# library dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_ZUC) += lib/librte_cryptodev
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index a16f25e2e..07d283b27 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -31,34 +31,63 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+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_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_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_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_MLX4_PMD) += mlx4
+DEPDIRS-mlx4 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5
+DEPDIRS-mlx5 = $(core-libs)
 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_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)
 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)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
+DEPDIRS-xenvirt = $(core-libs)
 
 ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += vhost
 endif # $(CONFIG_RTE_LIBRTE_VHOST)
+DEPDIRS-vhost = $(core-libs) librte_vhost
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/drivers/net/af_packet/Makefile b/drivers/net/af_packet/Makefile
index e14d6d0c6..70d517c16 100644
--- a/drivers/net/af_packet/Makefile
+++ b/drivers/net/af_packet/Makefile
@@ -50,11 +50,4 @@ CFLAGS += $(WERROR_FLAGS)
 #
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += rte_eth_af_packet.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/bnx2x/Makefile b/drivers/net/bnx2x/Makefile
index e971fb667..e12310691 100644
--- a/drivers/net/bnx2x/Makefile
+++ b/drivers/net/bnx2x/Makefile
@@ -29,8 +29,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += ecore_sp.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += elink.c
 SRCS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += bnx2x_vfpf.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += lib/librte_mempool lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/bnxt/Makefile b/drivers/net/bnxt/Makefile
index 65aaa929a..0fffe3561 100644
--- a/drivers/net/bnxt/Makefile
+++ b/drivers/net/bnxt/Makefile
@@ -66,10 +66,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt_irq.c
 #
 SYMLINK-y-include +=
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile
index 504f2e8b5..910c932da 100644
--- a/drivers/net/bonding/Makefile
+++ b/drivers/net/bonding/Makefile
@@ -58,13 +58,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += rte_eth_bond_alb.c
 SYMLINK-y-include += rte_eth_bond.h
 SYMLINK-y-include += rte_eth_bond_8023ad.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_cmdline
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += lib/librte_ring
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/cxgbe/Makefile b/drivers/net/cxgbe/Makefile
index bfcc3159f..7cef6279c 100644
--- a/drivers/net/cxgbe/Makefile
+++ b/drivers/net/cxgbe/Makefile
@@ -81,9 +81,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += cxgbe_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += sge.c
 SRCS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += t4_hw.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CXGBE_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
index 57a60f0fc..a32fabe5f 100644
--- a/drivers/net/e1000/Makefile
+++ b/drivers/net/e1000/Makefile
@@ -96,9 +96,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_IGB_PMD) += igb_pf.c
 SRCS-$(CONFIG_RTE_LIBRTE_EM_PMD) += em_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EM_PMD) += em_rxtx.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/ena/Makefile b/drivers/net/ena/Makefile
index a0d3358d2..bf1f5da07 100644
--- a/drivers/net/ena/Makefile
+++ b/drivers/net/ena/Makefile
@@ -51,11 +51,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena_com.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += ena_eth_com.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENA_PMD) += lib/librte_net
-
 CFLAGS += $(INCLUDES)
 
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/enic/Makefile b/drivers/net/enic/Makefile
index 3926b795c..2c7496dc5 100644
--- a/drivers/net/enic/Makefile
+++ b/drivers/net/enic/Makefile
@@ -63,10 +63,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_intr.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_rq.c
 SRCS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += base/vnic_rss.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/fm10k/Makefile b/drivers/net/fm10k/Makefile
index afcbd1d83..71d836cbb 100644
--- a/drivers/net/fm10k/Makefile
+++ b/drivers/net/fm10k/Makefile
@@ -96,10 +96,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k_vf.c
 SRCS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k_api.c
 SRCS-$(CONFIG_RTE_LIBRTE_FM10K_INC_VECTOR) += fm10k_rxtx_vec.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 94482cf7c..9237f8480 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -115,11 +115,4 @@ endif
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_I40E_PMD)-include := rte_pmd_i40e.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/ixgbe/Makefile b/drivers/net/ixgbe/Makefile
index 38b9fbdf5..f62f3d52c 100644
--- a/drivers/net/ixgbe/Makefile
+++ b/drivers/net/ixgbe/Makefile
@@ -124,10 +124,4 @@ endif
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)-include := rte_pmd_ixgbe.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/mlx4/Makefile b/drivers/net/mlx4/Makefile
index 68c590231..d30553e06 100644
--- a/drivers/net/mlx4/Makefile
+++ b/drivers/net/mlx4/Makefile
@@ -37,12 +37,6 @@ LIB = librte_pmd_mlx4.a
 # Sources.
 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4.c
 
-# Dependencies.
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_mempool
-
 # Basic CFLAGS.
 CFLAGS += -O3
 CFLAGS += -std=gnu99 -Wall -Wextra
diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index 671089c3f..d18de6b8b 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -50,13 +50,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_fdir.c
 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_mr.c
 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_flow.c
 
-# Dependencies.
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_kvargs
-
 # Basic CFLAGS.
 CFLAGS += -O3
 CFLAGS += -std=gnu99 -Wall -Wextra
diff --git a/drivers/net/nfp/Makefile b/drivers/net/nfp/Makefile
index 4cadd131d..4ee2c2dc2 100644
--- a/drivers/net/nfp/Makefile
+++ b/drivers/net/nfp/Makefile
@@ -50,9 +50,4 @@ LIBABIVER := 1
 #
 SRCS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp_net.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/null/Makefile b/drivers/net/null/Makefile
index 0c909c6f4..40a839fc4 100644
--- a/drivers/net/null/Makefile
+++ b/drivers/net/null/Makefile
@@ -53,11 +53,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += rte_eth_null.c
 #
 SYMLINK-y-include += rte_eth_null.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/pcap/Makefile b/drivers/net/pcap/Makefile
index 89ac40249..7ebd0bef2 100644
--- a/drivers/net/pcap/Makefile
+++ b/drivers/net/pcap/Makefile
@@ -55,11 +55,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += rte_eth_pcap.c
 #
 SYMLINK-y-include +=
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 29b443df0..d989536f4 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -100,9 +100,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_eth_if.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_main.c
 SRCS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += qede_rxtx.c
 
-# dependent libs:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_QEDE_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/ring/Makefile b/drivers/net/ring/Makefile
index ae8350525..b7e1a378a 100644
--- a/drivers/net/ring/Makefile
+++ b/drivers/net/ring/Makefile
@@ -53,9 +53,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += rte_eth_ring.c
 #
 SYMLINK-y-include += rte_eth_ring.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_eal lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_mbuf lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_RING) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/sfc/Makefile b/drivers/net/sfc/Makefile
index 619a0edd1..f4d0b61a5 100644
--- a/drivers/net/sfc/Makefile
+++ b/drivers/net/sfc/Makefile
@@ -133,12 +133,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += ef10_vpd.c
 SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += hunt_nic.c
 SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += medford_nic.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/szedata2/Makefile b/drivers/net/szedata2/Makefile
index 4a7b14c9b..836c3b2ad 100644
--- a/drivers/net/szedata2/Makefile
+++ b/drivers/net/szedata2/Makefile
@@ -54,11 +54,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += rte_eth_szedata2.c
 #
 SYMLINK-y-include +=
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_SZEDATA2) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile
index e18f30c56..bedd1b738 100644
--- a/drivers/net/tap/Makefile
+++ b/drivers/net/tap/Makefile
@@ -47,11 +47,4 @@ CFLAGS += $(WERROR_FLAGS)
 #
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += rte_eth_tap.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_TAP) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/thunderx/Makefile b/drivers/net/thunderx/Makefile
index bcab5f933..706250b8b 100644
--- a/drivers/net/thunderx/Makefile
+++ b/drivers/net/thunderx/Makefile
@@ -65,8 +65,4 @@ CFLAGS_nicvf_rxtx.o += -fno-prefetch-loop-arrays
 endif
 CFLAGS_nicvf_rxtx.o += -Ofast
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += lib/librte_mempool lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/vhost/Makefile b/drivers/net/vhost/Makefile
index 050c5aa52..3ba8ad64f 100644
--- a/drivers/net/vhost/Makefile
+++ b/drivers/net/vhost/Makefile
@@ -55,12 +55,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += rte_eth_vhost.c
 #
 SYMLINK-y-include += rte_eth_vhost.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_kvargs
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += lib/librte_vhost
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/virtio/Makefile b/drivers/net/virtio/Makefile
index 8b5b5d6ab..b21b87814 100644
--- a/drivers/net/virtio/Makefile
+++ b/drivers/net/virtio/Makefile
@@ -66,10 +66,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_user/virtio_user_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_user_ethdev.c
 endif
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/vmxnet3/Makefile b/drivers/net/vmxnet3/Makefile
index 23ff1da29..84356ae22 100644
--- a/drivers/net/vmxnet3/Makefile
+++ b/drivers/net/vmxnet3/Makefile
@@ -76,9 +76,4 @@ LIBABIVER := 1
 SRCS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3_rxtx.c
 SRCS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3_ethdev.c
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/xenvirt/Makefile b/drivers/net/xenvirt/Makefile
index 1d05b71b4..8b4b8f037 100644
--- a/drivers/net/xenvirt/Makefile
+++ b/drivers/net/xenvirt/Makefile
@@ -54,10 +54,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += rte_eth_xenvirt.c rte_mempool_gntalloc.
 #
 SYMLINK-y-include += rte_eth_xenvirt.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += lib/librte_eal lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += lib/librte_net
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += lib/librte_cmdline
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/examples/ethtool/Makefile b/examples/ethtool/Makefile
index 995cd25be..30b42b70e 100644
--- a/examples/ethtool/Makefile
+++ b/examples/ethtool/Makefile
@@ -46,4 +46,7 @@ else
 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 46b1b3abf..197c1d6f5 100644
--- a/examples/ethtool/lib/Makefile
+++ b/examples/ethtool/lib/Makefile
@@ -58,8 +58,4 @@ ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
 LDLIBS += -lrte_pmd_ixgbe
 endif
 
-# internal dependencies
-DEPDIRS-y += lib/librte_eal
-DEPDIRS-y += lib/librte_ether
-
 include $(RTE_SDK)/mk/rte.extlib.mk
diff --git a/lib/Makefile b/lib/Makefile
index 41783252b..d0ea0682d 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -34,34 +34,68 @@ include $(RTE_SDK)/mk/rte.vars.mk
 DIRS-y += librte_compat
 DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring
+DEPDIRS-librte_ring := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool
+DEPDIRS-librte_mempool := librte_eal librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_MBUF) += librte_mbuf
+DEPDIRS-librte_mbuf := librte_eal librte_mempool
 DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer
+DEPDIRS-librte_timer := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile
+DEPDIRS-librte_cfgfile := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline
+DEPDIRS-librte_cmdline := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_ETHER) += librte_ether
+DEPDIRS-librte_ether := librte_net librte_eal librte_mempool librte_ring
+DEPDIRS-librte_ether += librte_mbuf
 DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += librte_cryptodev
+DEPDIRS-librte_cryptodev := librte_eal librte_mempool librte_ring librte_mbuf
+DEPDIRS-librte_cryptodev += librte_kvargs
 DIRS-$(CONFIG_RTE_LIBRTE_VHOST) += librte_vhost
+DEPDIRS-librte_vhost := librte_eal librte_mempool librte_mbuf librte_ether
 DIRS-$(CONFIG_RTE_LIBRTE_HASH) += librte_hash
+DEPDIRS-librte_hash := librte_eal librte_ring
 DIRS-$(CONFIG_RTE_LIBRTE_EFD) += librte_efd
+DEPDIRS-librte_efd := librte_eal librte_ring librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_LPM) += librte_lpm
+DEPDIRS-librte_lpm := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_ACL) += librte_acl
+DEPDIRS-librte_acl := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_NET) += librte_net
+DEPDIRS-librte_net := librte_mbuf
 DIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += librte_ip_frag
+DEPDIRS-librte_ip_frag := librte_eal librte_ether librte_hash librte_mbuf
+DEPDIRS-librte_ip_frag += librte_mempool
 DIRS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += librte_jobstats
+DEPDIRS-librte_jobstats := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_POWER) += librte_power
+DEPDIRS-librte_power := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_METER) += librte_meter
+DEPDIRS-librte_meter := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_SCHED) += librte_sched
+DEPDIRS-librte_sched := librte_eal librte_mempool librte_mbuf librte_net
+DEPDIRS-librte_sched += librte_timer
 DIRS-$(CONFIG_RTE_LIBRTE_KVARGS) += librte_kvargs
+DEPDIRS-librte_kvargs := librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += librte_distributor
+DEPDIRS-librte_distributor := librte_eal librte_mbuf librte_ether
 DIRS-$(CONFIG_RTE_LIBRTE_PORT) += librte_port
+DEPDIRS-librte_port := librte_eal librte_mbuf librte_mempool librte_ether
+DEPDIRS-librte_port += librte_ip_frag librte_sched librte_kni
 DIRS-$(CONFIG_RTE_LIBRTE_TABLE) += librte_table
+DEPDIRS-librte_table := librte_eal librte_mbuf librte_mempool librte_port
+DEPDIRS-librte_table += librte_lpm librte_acl librte_hash
 DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += librte_pipeline
+DEPDIRS-librte_pipeline := librte_eal librte_meter librte_mempool librte_table
+DEPDIRS-librte_pipeline += librte_port
 DIRS-$(CONFIG_RTE_LIBRTE_REORDER) += librte_reorder
+DEPDIRS-librte_reorder := librte_mbuf librte_mempool librte_eal
 DIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += librte_pdump
+DEPDIRS-librte_pdump := librte_eal librte_mbuf librte_mempool librte_ether
 
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
 DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni
 endif
+DEPDIRS-librte_kni:= librte_eal librte_mbuf librte_mempool librte_ether
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index d05be665a..e2dacd606 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -92,7 +92,4 @@ endif
 SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include := rte_acl_osdep.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_ACL)-include += rte_acl.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_ACL) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_cfgfile/Makefile b/lib/librte_cfgfile/Makefile
index 616aef092..755ef11f6 100644
--- a/lib/librte_cfgfile/Makefile
+++ b/lib/librte_cfgfile/Makefile
@@ -51,7 +51,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_CFGFILE) += rte_cfgfile.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_CFGFILE)-include += rte_cfgfile.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index 7d2d148c7..644f68e47 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -61,7 +61,4 @@ INCS += cmdline_parse_etheraddr.h cmdline_parse_string.h cmdline_rdline.h
 INCS += cmdline_vt100.h cmdline_socket.h cmdline_cirbuf.h cmdline_parse_portlist.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_CMDLINE)-include := $(INCS)
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_cryptodev/Makefile b/lib/librte_cryptodev/Makefile
index aebf5d9fa..18f5e8c53 100644
--- a/lib/librte_cryptodev/Makefile
+++ b/lib/librte_cryptodev/Makefile
@@ -52,11 +52,4 @@ SYMLINK-y-include += rte_cryptodev_pmd.h
 # versioning export map
 EXPORT_MAP := rte_cryptodev_version.map
 
-# library dependencies
-DEPDIRS-y += lib/librte_eal
-DEPDIRS-y += lib/librte_mempool
-DEPDIRS-y += lib/librte_ring
-DEPDIRS-y += lib/librte_mbuf
-DEPDIRS-y += lib/librte_kvargs
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_distributor/Makefile b/lib/librte_distributor/Makefile
index 4c9af172a..e3a3a79ef 100644
--- a/lib/librte_distributor/Makefile
+++ b/lib/librte_distributor/Makefile
@@ -47,8 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) := rte_distributor.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)-include := rte_distributor.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_eal/Makefile b/lib/librte_eal/Makefile
index cf11a0998..5690bb49d 100644
--- a/lib/librte_eal/Makefile
+++ b/lib/librte_eal/Makefile
@@ -33,6 +33,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 DIRS-y += common
 DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += linuxapp
+DEPDIRS-linuxapp := common
 DIRS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += bsdapp
+DEPDIRS-bsdapp := common
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile
index cce99f79a..16791df5a 100644
--- a/lib/librte_eal/bsdapp/eal/Makefile
+++ b/lib/librte_eal/bsdapp/eal/Makefile
@@ -111,7 +111,4 @@ INC := rte_interrupts.h
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_BSDAPP)-include/exec-env := \
 	$(addprefix include/exec-env/,$(INC))
 
-DEPDIRS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += lib/librte_eal/common
-DEPDIRS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += lib/librte_eal/common/arch/$(ARCH_DIR)
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_eal/linuxapp/Makefile b/lib/librte_eal/linuxapp/Makefile
index 20d2a9169..4794696b6 100644
--- a/lib/librte_eal/linuxapp/Makefile
+++ b/lib/librte_eal/linuxapp/Makefile
@@ -34,6 +34,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal
 DIRS-$(CONFIG_RTE_EAL_IGB_UIO) += igb_uio
 DIRS-$(CONFIG_RTE_KNI_KMOD) += kni
+DEPDIRS-kni := eal
 DIRS-$(CONFIG_RTE_LIBRTE_XEN_DOM0) += xen_dom0
+DEPDIRS-xen_dom0 := eal
 
 include $(RTE_SDK)/mk/rte.subdir.mk
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index aa874a5a4..8624ad26f 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -131,7 +131,4 @@ INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUXAPP)-include/exec-env := \
 	$(addprefix include/exec-env/,$(INC))
 
-DEPDIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += lib/librte_eal/common
-DEPDIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += lib/librte_eal/common/arch/$(ARCH_DIR)
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_eal/linuxapp/kni/Makefile b/lib/librte_eal/linuxapp/kni/Makefile
index 7864a2af7..154c528db 100644
--- a/lib/librte_eal/linuxapp/kni/Makefile
+++ b/lib/librte_eal/linuxapp/kni/Makefile
@@ -53,9 +53,6 @@ UBUNTU_KERNEL_CODE := $(shell echo `grep UTS_RELEASE $(RTE_KERNELDIR)/include/ge
 MODULE_CFLAGS += -D"UBUNTU_KERNEL_CODE=UBUNTU_KERNEL_VERSION($(UBUNTU_KERNEL_CODE))"
 endif
 
-# this lib needs main eal
-DEPDIRS-y += lib/librte_eal/linuxapp/eal
-
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_eal/linuxapp/xen_dom0/Makefile b/lib/librte_eal/linuxapp/xen_dom0/Makefile
index 9d22fb97d..be51a82aa 100644
--- a/lib/librte_eal/linuxapp/xen_dom0/Makefile
+++ b/lib/librte_eal/linuxapp/xen_dom0/Makefile
@@ -44,9 +44,6 @@ MODULE_CFLAGS += -I$(RTE_OUTPUT)/include
 MODULE_CFLAGS += -include $(RTE_OUTPUT)/include/rte_config.h
 MODULE_CFLAGS += -Wall -Werror
 
-# this lib needs main eal
-DEPDIRS-y += lib/librte_eal/linuxapp/eal
-
 #
 # all source are stored in SRCS-y
 #
diff --git a/lib/librte_efd/Makefile b/lib/librte_efd/Makefile
index a442c6260..b9277bc5d 100644
--- a/lib/librte_efd/Makefile
+++ b/lib/librte_efd/Makefile
@@ -47,9 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_EFD) := rte_efd.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_EFD)-include := rte_efd.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_EFD) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_EFD) += lib/librte_ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_EFD) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile
index 1d095a93c..066114b1d 100644
--- a/lib/librte_ether/Makefile
+++ b/lib/librte_ether/Makefile
@@ -55,7 +55,4 @@ SYMLINK-y-include += rte_dev_info.h
 SYMLINK-y-include += rte_flow.h
 SYMLINK-y-include += rte_flow_driver.h
 
-# this lib depends upon:
-DEPDIRS-y += lib/librte_net lib/librte_eal lib/librte_mempool lib/librte_ring lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_hash/Makefile b/lib/librte_hash/Makefile
index bb1ea9905..d856aa26d 100644
--- a/lib/librte_hash/Makefile
+++ b/lib/librte_hash/Makefile
@@ -55,7 +55,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_jhash.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_thash.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include += rte_fbk_hash.h
 
-# this lib needs eal and ring
-DEPDIRS-$(CONFIG_RTE_LIBRTE_HASH) += lib/librte_eal lib/librte_ring
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ip_frag/Makefile b/lib/librte_ip_frag/Makefile
index 43f8b1e38..4e693bf8f 100644
--- a/lib/librte_ip_frag/Makefile
+++ b/lib/librte_ip_frag/Makefile
@@ -52,10 +52,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += ip_frag_internal.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_IP_FRAG)-include += rte_ip_frag.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_hash
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += lib/librte_mempool
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_jobstats/Makefile b/lib/librte_jobstats/Makefile
index 136a448ea..561a0678c 100644
--- a/lib/librte_jobstats/Makefile
+++ b/lib/librte_jobstats/Makefile
@@ -47,7 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_JOBSTATS) := rte_jobstats.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_JOBSTATS)-include := rte_jobstats.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_kni/Makefile b/lib/librte_kni/Makefile
index 094744613..70f1ca8f6 100644
--- a/lib/librte_kni/Makefile
+++ b/lib/librte_kni/Makefile
@@ -46,9 +46,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_KNI) := rte_kni.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_KNI)-include := rte_kni.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KNI) += lib/librte_ether
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
index 87b09f204..564dd3102 100644
--- a/lib/librte_kvargs/Makefile
+++ b/lib/librte_kvargs/Makefile
@@ -49,7 +49,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) := rte_kvargs.c
 INCS := rte_kvargs.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_KVARGS)-include := $(INCS)
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_KVARGS) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 3dc549dcf..32be46b3b 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -55,7 +55,4 @@ else ifeq ($(CONFIG_RTE_ARCH_PPC_64),y)
 SYMLINK-$(CONFIG_RTE_LIBRTE_LPM)-include += rte_lpm_altivec.h
 endif
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_LPM) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 4ae2e8c8f..956902ab4 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -46,7 +46,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_MBUF) := rte_mbuf.c rte_mbuf_ptype.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_MBUF)-include := rte_mbuf.h rte_mbuf_ptype.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MBUF) += lib/librte_eal lib/librte_mempool
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
index 057a6ab40..96b6ca2c9 100644
--- a/lib/librte_mempool/Makefile
+++ b/lib/librte_mempool/Makefile
@@ -48,6 +48,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_MEMPOOL) +=  rte_mempool_stack.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_MEMPOOL)-include := rte_mempool.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += lib/librte_eal lib/librte_ring
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_meter/Makefile b/lib/librte_meter/Makefile
index f07fced71..539bfddd8 100644
--- a/lib/librte_meter/Makefile
+++ b/lib/librte_meter/Makefile
@@ -53,7 +53,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_METER) := rte_meter.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_METER)-include := rte_meter.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_METER) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 20cf6644a..abd5c46a4 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -45,6 +45,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_NET) += lib/librte_eal lib/librte_mbuf
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pdump/Makefile b/lib/librte_pdump/Makefile
index 166441a20..1c03bcbb7 100644
--- a/lib/librte_pdump/Makefile
+++ b/lib/librte_pdump/Makefile
@@ -48,10 +48,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PDUMP) := rte_pdump.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_PDUMP)-include := rte_pdump.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += lib/librte_ether
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pipeline/Makefile b/lib/librte_pipeline/Makefile
index 05d64ff84..7a835fd55 100644
--- a/lib/librte_pipeline/Makefile
+++ b/lib/librte_pipeline/Makefile
@@ -51,11 +51,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := rte_pipeline.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_PIPELINE)-include += rte_pipeline.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_table
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += lib/librte_port
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile
index 44fa73520..76629a13a 100644
--- a/lib/librte_port/Makefile
+++ b/lib/librte_port/Makefile
@@ -77,15 +77,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_kni.h
 endif
 SYMLINK-$(CONFIG_RTE_LIBRTE_PORT)-include += rte_port_source_sink.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) := lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_ip_frag
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_sched
-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
-DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_kni
-endif
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index cee95cd84..06cd10e86 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -47,7 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_POWER)-include := rte_power.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_POWER) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_reorder/Makefile b/lib/librte_reorder/Makefile
index 0d111aad8..4e44e72f0 100644
--- a/lib/librte_reorder/Makefile
+++ b/lib/librte_reorder/Makefile
@@ -47,9 +47,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_REORDER) := rte_reorder.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_REORDER)-include := rte_reorder.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_REORDER) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_REORDER) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_REORDER) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
index 4b1112e41..3e2f4b873 100644
--- a/lib/librte_ring/Makefile
+++ b/lib/librte_ring/Makefile
@@ -46,6 +46,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_RING) := rte_ring.c
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_RING)-include := rte_ring.h
 
-DEPDIRS-$(CONFIG_RTE_LIBRTE_RING) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile
index 44cb780f7..18274e73c 100644
--- a/lib/librte_sched/Makefile
+++ b/lib/librte_sched/Makefile
@@ -58,9 +58,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_SCHED) += rte_reciprocal.c
 SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h rte_bitmap.h rte_sched_common.h rte_red.h rte_approx.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_reciprocal.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_mempool lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_SCHED) += lib/librte_net lib/librte_timer
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_table/Makefile b/lib/librte_table/Makefile
index c82c76961..0d06d36a2 100644
--- a/lib/librte_table/Makefile
+++ b/lib/librte_table/Makefile
@@ -72,15 +72,4 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_lru.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_array.h
 SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_stub.h
 
-# this lib depends upon:
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) := lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_port
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_lpm
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_acl
-endif
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TABLE) += lib/librte_hash
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_timer/Makefile b/lib/librte_timer/Makefile
index 2aabef852..03a15390e 100644
--- a/lib/librte_timer/Makefile
+++ b/lib/librte_timer/Makefile
@@ -46,7 +46,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_TIMER) := rte_timer.c
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_TIMER)-include := rte_timer.h
 
-# this lib needs eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_TIMER) += lib/librte_eal
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
index 415ffc6e3..1b224b3e3 100644
--- a/lib/librte_vhost/Makefile
+++ b/lib/librte_vhost/Makefile
@@ -53,11 +53,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_VHOST) := fd_man.c socket.c vhost.c vhost_user.c \
 # install includes
 SYMLINK-$(CONFIG_RTE_LIBRTE_VHOST)-include += rte_virtio_net.h
 
-# dependencies
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_eal
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_ether
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_mbuf
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_mempool
-DEPDIRS-$(CONFIG_RTE_LIBRTE_VHOST) += lib/librte_net
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/mk/internal/rte.depdirs-post.mk b/mk/internal/rte.depdirs-post.mk
deleted file mode 100644
index eb73ad336..000000000
--- a/mk/internal/rte.depdirs-post.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-#   BSD LICENSE
-#
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   All rights reserved.
-#
-#   Redistribution and use in source and binary forms, with or without
-#   modification, are permitted provided that the following conditions
-#   are met:
-#
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in
-#       the documentation and/or other materials provided with the
-#       distribution.
-#     * Neither the name of Intel Corporation nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
-#
-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-.PHONY: depdirs $(DEPDIRS-y)
-depdirs: $(DEPDIRS-y)
-	@echo ""
-
-$(DEPDIRS-y):
-	@$(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $@
-
-.PHONY: depgraph
-depgraph:
-	@for d in $(DEPDIRS-y); do \
-		echo "    \"$(S)\" -> \"$$d\"" ; \
-	done
diff --git a/mk/internal/rte.depdirs-pre.mk b/mk/internal/rte.depdirs-pre.mk
deleted file mode 100644
index 8825db03b..000000000
--- a/mk/internal/rte.depdirs-pre.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-#   BSD LICENSE
-#
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   All rights reserved.
-#
-#   Redistribution and use in source and binary forms, with or without
-#   modification, are permitted provided that the following conditions
-#   are met:
-#
-#     * Redistributions of source code must retain the above copyright
-#       notice, this list of conditions and the following disclaimer.
-#     * Redistributions in binary form must reproduce the above copyright
-#       notice, this list of conditions and the following disclaimer in
-#       the documentation and/or other materials provided with the
-#       distribution.
-#     * Neither the name of Intel Corporation nor the names of its
-#       contributors may be used to endorse or promote products derived
-#       from this software without specific prior written permission.
-#
-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# nothing
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 0e0b6002d..62a2a1a0b 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -34,7 +34,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -278,7 +277,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 ifneq ($(wildcard $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.app.mk),)
 include $(RTE_SDK)/mk/target/$(RTE_TARGET)/rte.app.mk
diff --git a/mk/rte.bsdmodule.mk b/mk/rte.bsdmodule.mk
index 86b92ff5d..6fc137ad2 100644
--- a/mk/rte.bsdmodule.mk
+++ b/mk/rte.bsdmodule.mk
@@ -43,7 +43,6 @@ else
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # DPDK uses a more up-to-date gcc, so clear the override here.
 unexport CC
@@ -111,7 +110,6 @@ doclean:
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.extsubdir.mk b/mk/rte.extsubdir.mk
index f50f0062b..3e733d826 100644
--- a/mk/rte.extsubdir.mk
+++ b/mk/rte.extsubdir.mk
@@ -30,6 +30,8 @@
 
 MAKEFLAGS += --no-print-directory
 
+ALL_DEPDIRS := $(patsubst DEPDIRS-%,%,$(filter DEPDIRS-%,$(.VARIABLES)))
+
 # output directory
 O ?= .
 BASE_OUTPUT ?= $(O)
@@ -50,4 +52,16 @@ $(DIRS-y):
 		BASE_OUTPUT=$(BASE_OUTPUT) \
 		CUR_SUBDIR=$(CUR_SUBDIR)/$(@) \
 		S=$(CURDIR)/$(@) \
+		DEPDIRS="$(DEPDIRS-$@)" \
 		$(filter-out $(DIRS-y),$(MAKECMDGOALS))
+
+define depdirs_rule
+$(DEPDIRS-$(1)):
+
+$(1): | $(DEPDIRS-$(1))
+
+$(if $(D),$(info $(1) depends on $(DEPDIRS-$(1))))
+endef
+
+$(foreach dir,$(ALL_DEPDIRS),\
+	$(eval $(call depdirs_rule,$(dir))))
diff --git a/mk/rte.gnuconfigure.mk b/mk/rte.gnuconfigure.mk
index 65b658c13..b5c8df0f4 100644
--- a/mk/rte.gnuconfigure.mk
+++ b/mk/rte.gnuconfigure.mk
@@ -32,7 +32,6 @@
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -68,7 +67,6 @@ doclean:
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk
index 07b391c2b..5cb4909cb 100644
--- a/mk/rte.hostapp.mk
+++ b/mk/rte.hostapp.mk
@@ -35,7 +35,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -117,7 +116,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.hostlib.mk b/mk/rte.hostlib.mk
index fe24049f6..7709cff7d 100644
--- a/mk/rte.hostlib.mk
+++ b/mk/rte.hostlib.mk
@@ -35,7 +35,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -110,7 +109,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.install.mk b/mk/rte.install.mk
index e7ac4d5be..96144fbbb 100644
--- a/mk/rte.install.mk
+++ b/mk/rte.install.mk
@@ -33,7 +33,6 @@
 
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -55,4 +54,3 @@ doclean:
 
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index 5b72475d2..bc2f2fbeb 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -33,7 +33,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 EXTLIB_BUILD ?= n
 
@@ -85,12 +84,12 @@ else
 _CPU_LDFLAGS := $(CPU_LDFLAGS)
 endif
 
-# Translate DEPDIRS-y into LDLIBS
+# Translate DEPDIRS into LDLIBS
 # Ignore (sub)directory dependencies which do not provide an actual library
-_IGNORE_DIRS = lib/librte_eal/% lib/librte_compat
-_DEPDIRS = $(filter-out $(_IGNORE_DIRS),$(DEPDIRS-y))
+_IGNORE_DIRS = librte_eal/% librte_compat
+_DEPDIRS = $(filter-out $(_IGNORE_DIRS),$(DEPDIRS))
 _LDDIRS = $(subst librte_ether,librte_ethdev,$(_DEPDIRS))
-LDLIBS += $(subst lib/lib,-l,$(_LDDIRS))
+LDLIBS += $(subst lib,-l,$(_LDDIRS))
 
 O_TO_A = $(AR) crDs $(LIB) $(OBJS-y)
 O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight
@@ -183,7 +182,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.module.mk b/mk/rte.module.mk
index 53ed4fe98..3dd9ac786 100644
--- a/mk/rte.module.mk
+++ b/mk/rte.module.mk
@@ -43,7 +43,6 @@ else
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -108,7 +107,6 @@ doclean:
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.obj.mk b/mk/rte.obj.mk
index 5982227d3..9336d5f82 100644
--- a/mk/rte.obj.mk
+++ b/mk/rte.obj.mk
@@ -33,7 +33,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -106,7 +105,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.sdkbuild.mk b/mk/rte.sdkbuild.mk
index 02ff35b02..0bf909e9e 100644
--- a/mk/rte.sdkbuild.mk
+++ b/mk/rte.sdkbuild.mk
@@ -38,18 +38,10 @@ else
   include $(RTE_SDK)/mk/rte.vars.mk
 endif
 
-#
-# include .depdirs and define rules to order priorities between build
-# of directories.
-#
--include $(RTE_OUTPUT)/.depdirs
-
-define depdirs_rule
-$(1): $(sort $(LOCAL_DEPDIRS-$(1)))
-endef
-
-$(foreach d,$(ROOTDIRS-y) $(ROOTDIRS-),$(eval $(call depdirs_rule,$(d))))
-drivers: | buildtools
+buildtools: | lib
+drivers: | lib buildtools
+app: | lib buildtools drivers
+test: | lib buildtools drivers
 
 #
 # build and clean targets
@@ -93,8 +85,8 @@ $(ROOTDIRS-y) $(ROOTDIRS-):
 
 RTE_MAKE_SUBTARGET ?= all
 
-%_sub: $(addsuffix _sub,$(FULL_DEPDIRS-$(*)))
-	@echo $(addsuffix _sub,$(FULL_DEPDIRS-$(*)))
+%_sub: $(addsuffix _sub,$(*))
+	@echo $(addsuffix _sub,$(*))
 	@[ -d $(BUILDDIR)/$* ] || mkdir -p $(BUILDDIR)/$*
 	@echo "== Build $*"
 	$(Q)$(MAKE) S=$* -f $(RTE_SRCDIR)/$*/Makefile -C $(BUILDDIR)/$* \
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index 97581c907..1f2d6bdfa 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -69,7 +69,6 @@ ifeq ($(RTE_CONFIG_TEMPLATE),)
 config: notemplate
 else
 config: $(RTE_OUTPUT)/include/rte_config.h $(RTE_OUTPUT)/Makefile
-	$(Q)$(MAKE) depdirs
 	@echo "Configuration done"
 endif
 
@@ -140,7 +139,6 @@ checkconfig:
 	fi
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkconfig.mk \
 		headerconfig NODOTCONF=1
-	$(Q)$(MAKE) -s depdirs
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.sdkdepdirs.mk b/mk/rte.sdkdepdirs.mk
index 1d4b12f27..1f27697b2 100644
--- a/mk/rte.sdkdepdirs.mk
+++ b/mk/rte.sdkdepdirs.mk
@@ -35,29 +35,3 @@ endif
 ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile))
   $(error "need a make config first")
 endif
-
-DEPDIR_FILES = $(addsuffix /.depdirs, $(addprefix $(BUILDDIR)/,$(ROOTDIRS-y) $(ROOTDIRS-)))
-
-.PHONY: depdirs
-depdirs: $(RTE_OUTPUT)/.depdirs
-$(RTE_OUTPUT)/.depdirs: $(DEPDIR_FILES)
-	@rm -f $@
-	@sort -u -o $@ $(DEPDIR_FILES)
-
-$(DEPDIR_FILES): $(RTE_OUTPUT)/.config
-	@dir=$(notdir $(@D)); \
-	[ -d $(BUILDDIR)/$$dir ] || mkdir -p $(BUILDDIR)/$$dir; \
-	$(MAKE) S=$$dir -f $(RTE_SRCDIR)/$$dir/Makefile depdirs > $@
-
-.PHONY: depgraph
-depgraph:
-	@echo "digraph unix {" ; \
-	echo "    size=\"6,6\";" ; \
-	echo "    node [color=lightblue2, style=filled];" ; \
-	for d in $(ROOTDIRS-y); do \
-		echo "    \"root\" -> \"$$d\"" ; \
-		if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \
-			$(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depgraph ; \
-		fi ; \
-	done ; \
-	echo "}"
diff --git a/mk/rte.sdkroot.mk b/mk/rte.sdkroot.mk
index f20563e9a..685d2f55b 100644
--- a/mk/rte.sdkroot.mk
+++ b/mk/rte.sdkroot.mk
@@ -111,10 +111,6 @@ help: doc-help
 doc-%:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkdoc.mk $*
 
-.PHONY: depdirs depgraph
-depdirs depgraph:
-	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkdepdirs.mk $@
-
 .PHONY: gcov gcovclean
 gcov gcovclean:
 	$(Q)$(MAKE) -f $(RTE_SDK)/mk/rte.sdkgcov.mk $@
diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk
index fc6b0b446..87ccf0ba4 100644
--- a/mk/rte.shared.mk
+++ b/mk/rte.shared.mk
@@ -32,7 +32,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-pre.mk
 include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
 
 # VPATH contains at least SRCDIR
 VPATH += $(SRCDIR)
@@ -131,7 +130,6 @@ include $(RTE_SDK)/mk/internal/rte.compile-post.mk
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
 include $(RTE_SDK)/mk/internal/rte.build-post.mk
-include $(RTE_SDK)/mk/internal/rte.depdirs-post.mk
 
 .PHONY: FORCE
 FORCE:
diff --git a/mk/rte.subdir.mk b/mk/rte.subdir.mk
index 5341f1feb..92f5de4c8 100644
--- a/mk/rte.subdir.mk
+++ b/mk/rte.subdir.mk
@@ -37,6 +37,8 @@ include $(RTE_SDK)/mk/internal/rte.install-pre.mk
 include $(RTE_SDK)/mk/internal/rte.clean-pre.mk
 include $(RTE_SDK)/mk/internal/rte.build-pre.mk
 
+ALL_DEPDIRS := $(patsubst DEPDIRS-%,%,$(filter DEPDIRS-%,$(.VARIABLES)))
+
 CLEANDIRS = $(addsuffix _clean,$(DIRS-y) $(DIRS-n) $(DIRS-))
 
 VPATH += $(SRCDIR)
@@ -60,7 +62,8 @@ build: _postbuild
 $(DIRS-y):
 	@[ -d $(CURDIR)/$@ ] || mkdir -p $(CURDIR)/$@
 	@echo "== Build $S/$@"
-	@$(MAKE) S=$S/$@ -f $(SRCDIR)/$@/Makefile -C $(CURDIR)/$@ all
+	@$(MAKE) S=$S/$@ -f $(SRCDIR)/$@/Makefile -C $(CURDIR)/$@ \
+		DEPDIRS="$(DEPDIRS-$@)" all
 
 .PHONY: clean
 clean: _postclean
@@ -72,34 +75,16 @@ clean: _postclean
 	fi
 	@rm -f $(_BUILD_TARGETS) $(_INSTALL_TARGETS) $(_CLEAN_TARGETS)
 
-#
-# include .depdirs and define rules to order priorities between build
-# of directories.
-#
--include $(RTE_OUTPUT)/.depdirs
-
 define depdirs_rule
-$(1): $(sort $(patsubst $(S)/%,%,$(LOCAL_DEPDIRS-$(S)/$(1))))
-endef
-
-$(foreach d,$(DIRS-y),$(eval $(call depdirs_rule,$(d))))
+$(DEPDIRS-$(1)):
 
-DEPDIRS = $(wildcard $(addprefix $(S)/,$(DIRS-y)))
+$(1): | $(DEPDIRS-$(1))
 
-.PHONY: depdirs $(DEPDIRS)
-depdirs: $(DEPDIRS)
-
-$(DEPDIRS):
-	@$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile depdirs
+$(if $(D),$(info $(1) depends on $(DEPDIRS-$(1))))
+endef
 
-.PHONY: depgraph
-depgraph:
-	@for d in $(DIRS-y); do \
-		echo "    \"$(S)\" -> \"$(S)/$$d\"" ; \
-		if [ -f $(SRCDIR)/$$d/Makefile ]; then \
-			$(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depgraph ; \
-		fi ; \
-	done
+$(foreach dir,$(ALL_DEPDIRS),\
+	$(eval $(call depdirs_rule,$(dir))))
 
 include $(RTE_SDK)/mk/internal/rte.install-post.mk
 include $(RTE_SDK)/mk/internal/rte.clean-post.mk
diff --git a/test/cmdline_test/Makefile b/test/cmdline_test/Makefile
index c6169f56d..e9eafd2de 100644
--- a/test/cmdline_test/Makefile
+++ b/test/cmdline_test/Makefile
@@ -47,9 +47,6 @@ SRCS-y += commands.c
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
 
-# this application needs libraries first
-DEPDIRS-y += lib drivers
-
 include $(RTE_SDK)/mk/rte.app.mk
 
 endif
diff --git a/test/test-acl/Makefile b/test/test-acl/Makefile
index 43dfdcbd5..29de80a3d 100644
--- a/test/test-acl/Makefile
+++ b/test/test-acl/Makefile
@@ -40,9 +40,6 @@ CFLAGS += $(WERROR_FLAGS)
 # all source are stored in SRCS-y
 SRCS-y := main.c
 
-# this application needs libraries first
-DEPDIRS-y += lib
-
 include $(RTE_SDK)/mk/rte.app.mk
 
 endif
diff --git a/test/test-pipeline/Makefile b/test/test-pipeline/Makefile
index 4bab6dc6c..520a319f3 100644
--- a/test/test-pipeline/Makefile
+++ b/test/test-pipeline/Makefile
@@ -56,9 +56,6 @@ SRCS-y += pipeline_lpm_ipv6.c
 # include ACL lib if available
 SRCS-$(CONFIG_RTE_LIBRTE_ACL) += pipeline_acl.c
 
-# this application needs libraries first
-DEPDIRS-y += lib drivers
-
 include $(RTE_SDK)/mk/rte.app.mk
 
 endif
diff --git a/test/test/Makefile b/test/test/Makefile
index 1a5e03dc6..79f0c6179 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -214,9 +214,6 @@ CFLAGS_test_memcpy_perf.o += -fno-var-tracking-assignments
 endif
 endif
 
-# this application needs libraries first
-DEPDIRS-y += lib drivers
-
 # Link against shared libraries when needed
 ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
 ifneq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
-- 
2.11.0

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

* Re: [dpdk-dev] [PATCH v2] mk: optimize directory dependencies
  2017-03-24 13:21       ` [dpdk-dev] [PATCH v2] " Olivier Matz
@ 2017-03-27 21:33         ` Thomas Monjalon
  2017-03-28 10:34         ` Ferruh Yigit
  1 sibling, 0 replies; 38+ messages in thread
From: Thomas Monjalon @ 2017-03-27 21:33 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, ferruh.yigit, robin.jarry, jerin.jacob, keith.wiles

2017-03-24 14:21, Olivier Matz:
> Before this patch, the management of dependencies between directories
> had several issues:
> 
> - the generation of .depdirs, done at configuration is slow: it can take
>   more than one minute on some slow targets (usually ~10s on a standard
>   PC without -j).
> 
> - for instance, it is possible to express a dependency like:
>   - app/foo depends on lib/librte_foo
>   - and lib/librte_foo depends on app/bar
>   But this won't work because the directories are traversed with a
>   depth-first algorithm, so we have to choose between doing 'app' before
>   or after 'lib'.
> 
> - the script depdirs-rule.sh is too complex.
> 
> - we cannot use "make -d" for debug, because the output of make is used for
>   the generation of .depdirs.
> 
> This patch moves the DEPDIRS-* variables in the upper Makefile, making
> the dependencies much easier to calculate. A DEPDIRS variable is still
> used to process library dependencies in LDLIBS.
> 
> After this commit, "make config" is almost immediate.
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> Tested-by: Robin Jarry <robin.jarry@6wind.com>
> Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

It is almost impossible to really review such a big change in Makefiles ;)

Fixed a typo in pipeline lib dependency, and
Applied, thanks

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

* Re: [dpdk-dev] [PATCH v2] mk: optimize directory dependencies
  2017-03-24 13:21       ` [dpdk-dev] [PATCH v2] " Olivier Matz
  2017-03-27 21:33         ` Thomas Monjalon
@ 2017-03-28 10:34         ` Ferruh Yigit
  2017-03-30  8:51           ` Olivier Matz
  1 sibling, 1 reply; 38+ messages in thread
From: Ferruh Yigit @ 2017-03-28 10:34 UTC (permalink / raw)
  To: Olivier Matz, dev; +Cc: thomas.monjalon, robin.jarry, jerin.jacob, keith.wiles

On 3/24/2017 1:21 PM, Olivier Matz wrote:
> Before this patch, the management of dependencies between directories
> had several issues:
> 
> - the generation of .depdirs, done at configuration is slow: it can take
>   more than one minute on some slow targets (usually ~10s on a standard
>   PC without -j).
> 
> - for instance, it is possible to express a dependency like:
>   - app/foo depends on lib/librte_foo
>   - and lib/librte_foo depends on app/bar
>   But this won't work because the directories are traversed with a
>   depth-first algorithm, so we have to choose between doing 'app' before
>   or after 'lib'.
> 
> - the script depdirs-rule.sh is too complex.
> 
> - we cannot use "make -d" for debug, because the output of make is used for
>   the generation of .depdirs.
> 
> This patch moves the DEPDIRS-* variables in the upper Makefile, making
> the dependencies much easier to calculate. A DEPDIRS variable is still
> used to process library dependencies in LDLIBS.
> 
> After this commit, "make config" is almost immediate.
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> Tested-by: Robin Jarry <robin.jarry@6wind.com>
> Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

<...>

>  DIRS-$(CONFIG_RTE_LIBRTE_PORT) += librte_port
> +DEPDIRS-librte_port := librte_eal librte_mbuf librte_mempool librte_ether
> +DEPDIRS-librte_port += librte_ip_frag librte_sched librte_kni
                                                         ^
---------------------------------------------------------+

<...>

> diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile
> index 44fa73520..76629a13a 100644
> --- a/lib/librte_port/Makefile
> +++ b/lib/librte_port/Makefile
<...>
> -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
> -DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_kni
> -endif

This check needs to be reflected to new method, otherwise causing build
errors for i686 target.

> -
>  include $(RTE_SDK)/mk/rte.lib.mk

<...>

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

* Re: [dpdk-dev] [PATCH v2] mk: optimize directory dependencies
  2017-03-28 10:34         ` Ferruh Yigit
@ 2017-03-30  8:51           ` Olivier Matz
  2017-03-30  9:27             ` Ferruh Yigit
  0 siblings, 1 reply; 38+ messages in thread
From: Olivier Matz @ 2017-03-30  8:51 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, thomas.monjalon, robin.jarry, jerin.jacob, keith.wiles

Hi Ferruh,

On Tue, 28 Mar 2017 11:34:35 +0100, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> On 3/24/2017 1:21 PM, Olivier Matz wrote:
> > Before this patch, the management of dependencies between directories
> > had several issues:
> > 
> > - the generation of .depdirs, done at configuration is slow: it can take
> >   more than one minute on some slow targets (usually ~10s on a standard
> >   PC without -j).
> > 
> > - for instance, it is possible to express a dependency like:
> >   - app/foo depends on lib/librte_foo
> >   - and lib/librte_foo depends on app/bar
> >   But this won't work because the directories are traversed with a
> >   depth-first algorithm, so we have to choose between doing 'app' before
> >   or after 'lib'.
> > 
> > - the script depdirs-rule.sh is too complex.
> > 
> > - we cannot use "make -d" for debug, because the output of make is used for
> >   the generation of .depdirs.
> > 
> > This patch moves the DEPDIRS-* variables in the upper Makefile, making
> > the dependencies much easier to calculate. A DEPDIRS variable is still
> > used to process library dependencies in LDLIBS.
> > 
> > After this commit, "make config" is almost immediate.
> > 
> > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> > Tested-by: Robin Jarry <robin.jarry@6wind.com>
> > Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>  
> 
> <...>
> 
> >  DIRS-$(CONFIG_RTE_LIBRTE_PORT) += librte_port
> > +DEPDIRS-librte_port := librte_eal librte_mbuf librte_mempool librte_ether
> > +DEPDIRS-librte_port += librte_ip_frag librte_sched librte_kni  
>                                                          ^
> ---------------------------------------------------------+
> 
> <...>
> 
> > diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile
> > index 44fa73520..76629a13a 100644
> > --- a/lib/librte_port/Makefile
> > +++ b/lib/librte_port/Makefile  
> <...>
> > -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
> > -DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_kni
> > -endif  
> 
> This check needs to be reflected to new method, otherwise causing build
> errors for i686 target.
> 

Did you notice an error? I see no error it with:

    make config T=x86_64-native-linuxapp-gcc
    sed -i 's,CONFIG_RTE_LIBRTE_KNI=y,# CONFIG_RTE_LIBRTE_KNI is not set,' build/.config
    make -j8


I think it is not a problem, the DEPDIRS-* variable only gives an
ordering directive, which should be ok even if kni is not compiled.


Regards,
Olivier

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

* Re: [dpdk-dev] [PATCH v2] mk: optimize directory dependencies
  2017-03-30  8:51           ` Olivier Matz
@ 2017-03-30  9:27             ` Ferruh Yigit
  2017-03-30 12:11               ` Olivier Matz
  0 siblings, 1 reply; 38+ messages in thread
From: Ferruh Yigit @ 2017-03-30  9:27 UTC (permalink / raw)
  To: Olivier Matz; +Cc: dev, thomas.monjalon, robin.jarry, jerin.jacob, keith.wiles

On 3/30/2017 9:51 AM, Olivier Matz wrote:
> Hi Ferruh,
> 
> On Tue, 28 Mar 2017 11:34:35 +0100, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>> On 3/24/2017 1:21 PM, Olivier Matz wrote:
>>> Before this patch, the management of dependencies between directories
>>> had several issues:
>>>
>>> - the generation of .depdirs, done at configuration is slow: it can take
>>>   more than one minute on some slow targets (usually ~10s on a standard
>>>   PC without -j).
>>>
>>> - for instance, it is possible to express a dependency like:
>>>   - app/foo depends on lib/librte_foo
>>>   - and lib/librte_foo depends on app/bar
>>>   But this won't work because the directories are traversed with a
>>>   depth-first algorithm, so we have to choose between doing 'app' before
>>>   or after 'lib'.
>>>
>>> - the script depdirs-rule.sh is too complex.
>>>
>>> - we cannot use "make -d" for debug, because the output of make is used for
>>>   the generation of .depdirs.
>>>
>>> This patch moves the DEPDIRS-* variables in the upper Makefile, making
>>> the dependencies much easier to calculate. A DEPDIRS variable is still
>>> used to process library dependencies in LDLIBS.
>>>
>>> After this commit, "make config" is almost immediate.
>>>
>>> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
>>> Tested-by: Robin Jarry <robin.jarry@6wind.com>
>>> Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>  
>>
>> <...>
>>
>>>  DIRS-$(CONFIG_RTE_LIBRTE_PORT) += librte_port
>>> +DEPDIRS-librte_port := librte_eal librte_mbuf librte_mempool librte_ether
>>> +DEPDIRS-librte_port += librte_ip_frag librte_sched librte_kni  
>>                                                          ^
>> ---------------------------------------------------------+
>>
>> <...>
>>
>>> diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile
>>> index 44fa73520..76629a13a 100644
>>> --- a/lib/librte_port/Makefile
>>> +++ b/lib/librte_port/Makefile  
>> <...>
>>> -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
>>> -DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_kni
>>> -endif  
>>
>> This check needs to be reflected to new method, otherwise causing build
>> errors for i686 target.
>>
> 
> Did you notice an error? I see no error it with:
> 
>     make config T=x86_64-native-linuxapp-gcc
>     sed -i 's,CONFIG_RTE_LIBRTE_KNI=y,# CONFIG_RTE_LIBRTE_KNI is not set,' build/.config
>     make -j8
> 
> 
> I think it is not a problem, the DEPDIRS-* variable only gives an
> ordering directive, which should be ok even if kni is not compiled.

Can you please test shared library build, I am getting following error:

== Build lib/librte_port
  LD librte_port.so.3.1
/usr/bin/ld: cannot find -lrte_kni
collect2: error: ld returned 1 exit status
.../mk/rte.lib.mk:127: recipe for target 'librte_port.so.3.1' failed
make[3]: *** [librte_port.so.3.1] Error 1
.../mk/rte.subdir.mk:63: recipe for target 'librte_port' failed

> 
> 
> Regards,
> Olivier
> 

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

* Re: [dpdk-dev] [PATCH v2] mk: optimize directory dependencies
  2017-03-30  9:27             ` Ferruh Yigit
@ 2017-03-30 12:11               ` Olivier Matz
  2017-03-30 12:32                 ` [dpdk-dev] [PATCH] mk: fix dependencies to optional configs Olivier Matz
  0 siblings, 1 reply; 38+ messages in thread
From: Olivier Matz @ 2017-03-30 12:11 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, thomas.monjalon, robin.jarry, jerin.jacob, keith.wiles

On Thu, 30 Mar 2017 10:27:49 +0100, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> On 3/30/2017 9:51 AM, Olivier Matz wrote:
> > Hi Ferruh,
> > 
> > On Tue, 28 Mar 2017 11:34:35 +0100, Ferruh Yigit <ferruh.yigit@intel.com> wrote:  
> >> On 3/24/2017 1:21 PM, Olivier Matz wrote:  
> >>> Before this patch, the management of dependencies between directories
> >>> had several issues:
> >>>
> >>> - the generation of .depdirs, done at configuration is slow: it can take
> >>>   more than one minute on some slow targets (usually ~10s on a standard
> >>>   PC without -j).
> >>>
> >>> - for instance, it is possible to express a dependency like:
> >>>   - app/foo depends on lib/librte_foo
> >>>   - and lib/librte_foo depends on app/bar
> >>>   But this won't work because the directories are traversed with a
> >>>   depth-first algorithm, so we have to choose between doing 'app' before
> >>>   or after 'lib'.
> >>>
> >>> - the script depdirs-rule.sh is too complex.
> >>>
> >>> - we cannot use "make -d" for debug, because the output of make is used for
> >>>   the generation of .depdirs.
> >>>
> >>> This patch moves the DEPDIRS-* variables in the upper Makefile, making
> >>> the dependencies much easier to calculate. A DEPDIRS variable is still
> >>> used to process library dependencies in LDLIBS.
> >>>
> >>> After this commit, "make config" is almost immediate.
> >>>
> >>> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> >>> Tested-by: Robin Jarry <robin.jarry@6wind.com>
> >>> Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>    
> >>
> >> <...>
> >>  
> >>>  DIRS-$(CONFIG_RTE_LIBRTE_PORT) += librte_port
> >>> +DEPDIRS-librte_port := librte_eal librte_mbuf librte_mempool librte_ether
> >>> +DEPDIRS-librte_port += librte_ip_frag librte_sched librte_kni    
> >>                                                          ^
> >> ---------------------------------------------------------+
> >>
> >> <...>
> >>  
> >>> diff --git a/lib/librte_port/Makefile b/lib/librte_port/Makefile
> >>> index 44fa73520..76629a13a 100644
> >>> --- a/lib/librte_port/Makefile
> >>> +++ b/lib/librte_port/Makefile    
> >> <...>  
> >>> -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
> >>> -DEPDIRS-$(CONFIG_RTE_LIBRTE_PORT) += lib/librte_kni
> >>> -endif    
> >>
> >> This check needs to be reflected to new method, otherwise causing build
> >> errors for i686 target.
> >>  
> > 
> > Did you notice an error? I see no error it with:
> > 
> >     make config T=x86_64-native-linuxapp-gcc
> >     sed -i 's,CONFIG_RTE_LIBRTE_KNI=y,# CONFIG_RTE_LIBRTE_KNI is not set,' build/.config
> >     make -j8
> > 
> > 
> > I think it is not a problem, the DEPDIRS-* variable only gives an
> > ordering directive, which should be ok even if kni is not compiled.  
> 
> Can you please test shared library build, I am getting following error:
> 
> == Build lib/librte_port
>   LD librte_port.so.3.1
> /usr/bin/ld: cannot find -lrte_kni
> collect2: error: ld returned 1 exit status
> .../mk/rte.lib.mk:127: recipe for target 'librte_port.so.3.1' failed
> make[3]: *** [librte_port.so.3.1] Error 1
> .../mk/rte.subdir.mk:63: recipe for target 'librte_port' failed
> 

You're right, it happens because the libray list is built from DEPDIRS.

Thanks for spotting it, I'll check if there are other occurences and send
a fix. The simple way is probably to restore the ifeq(), but I'm wondering
if having: DEPDIRS-$(cond)-$(path) wouldn't be shorter in Makefiles.

Olivier

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

* [dpdk-dev] [PATCH] mk: fix dependencies to optional configs
  2017-03-30 12:11               ` Olivier Matz
@ 2017-03-30 12:32                 ` Olivier Matz
  2017-03-30 12:37                   ` Ferruh Yigit
  0 siblings, 1 reply; 38+ messages in thread
From: Olivier Matz @ 2017-03-30 12:32 UTC (permalink / raw)
  To: dev; +Cc: thomas.monjalon, ferruh.yigit

In rte.lib.mk, the list of libraries passed to the link
command (LDLIBS) is generated from the DEPDIRS-xxx variables.
If a library is not compiled because it is disabled in
configuration, it should not appear in DEPDIRS-xxx.

- librte_port depends on librte_kni only if it is enabled.
- librte_table depends on librte_acl only if it is enabled.

Fixes: feb9f680cd2c ("mk: optimize directory dependencies")
Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 lib/Makefile | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/Makefile b/lib/Makefile
index 456eb38a4..b2545ff70 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -81,10 +81,16 @@ DIRS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += librte_distributor
 DEPDIRS-librte_distributor := librte_eal librte_mbuf librte_ether
 DIRS-$(CONFIG_RTE_LIBRTE_PORT) += librte_port
 DEPDIRS-librte_port := librte_eal librte_mempool librte_mbuf librte_ether
-DEPDIRS-librte_port += librte_ip_frag librte_sched librte_kni
+DEPDIRS-librte_port += librte_ip_frag librte_sched
+ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
+DEPDIRS-librte_port += librte_kni
+endif
 DIRS-$(CONFIG_RTE_LIBRTE_TABLE) += librte_table
 DEPDIRS-librte_table := librte_eal librte_mempool librte_mbuf
-DEPDIRS-librte_table += librte_port librte_lpm librte_acl librte_hash
+DEPDIRS-librte_table += librte_port librte_lpm librte_hash
+ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
+DEPDIRS-librte_table += librte_acl
+endif
 DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += librte_pipeline
 DEPDIRS-librte_pipeline := librte_eal librte_mempool librte_mbuf
 DEPDIRS-librte_pipeline += librte_table librte_port
-- 
2.11.0

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

* Re: [dpdk-dev] [PATCH] mk: fix dependencies to optional configs
  2017-03-30 12:32                 ` [dpdk-dev] [PATCH] mk: fix dependencies to optional configs Olivier Matz
@ 2017-03-30 12:37                   ` Ferruh Yigit
  2017-03-30 13:37                     ` Thomas Monjalon
  0 siblings, 1 reply; 38+ messages in thread
From: Ferruh Yigit @ 2017-03-30 12:37 UTC (permalink / raw)
  To: Olivier Matz, dev; +Cc: thomas.monjalon

On 3/30/2017 1:32 PM, Olivier Matz wrote:
> In rte.lib.mk, the list of libraries passed to the link
> command (LDLIBS) is generated from the DEPDIRS-xxx variables.
> If a library is not compiled because it is disabled in
> configuration, it should not appear in DEPDIRS-xxx.
> 
> - librte_port depends on librte_kni only if it is enabled.
> - librte_table depends on librte_acl only if it is enabled.
> 
> Fixes: feb9f680cd2c ("mk: optimize directory dependencies")
> Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>

Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>

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

* Re: [dpdk-dev] [PATCH] mk: fix dependencies to optional configs
  2017-03-30 12:37                   ` Ferruh Yigit
@ 2017-03-30 13:37                     ` Thomas Monjalon
  0 siblings, 0 replies; 38+ messages in thread
From: Thomas Monjalon @ 2017-03-30 13:37 UTC (permalink / raw)
  To: Olivier Matz; +Cc: Ferruh Yigit, dev

2017-03-30 13:37, Ferruh Yigit:
> On 3/30/2017 1:32 PM, Olivier Matz wrote:
> > In rte.lib.mk, the list of libraries passed to the link
> > command (LDLIBS) is generated from the DEPDIRS-xxx variables.
> > If a library is not compiled because it is disabled in
> > configuration, it should not appear in DEPDIRS-xxx.
> > 
> > - librte_port depends on librte_kni only if it is enabled.
> > - librte_table depends on librte_acl only if it is enabled.
> > 
> > Fixes: feb9f680cd2c ("mk: optimize directory dependencies")
> > Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
> > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied, thanks

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

end of thread, other threads:[~2017-03-30 13:37 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-22  1:50 [dpdk-dev] [PATCH] mk: parallelize make config Ferruh Yigit
2017-01-23 17:18 ` Olivier Matz
2017-01-23 17:19   ` [dpdk-dev] [PATCH] mk: optimize directory dependencies Olivier Matz
2017-01-24 11:19     ` Robin Jarry
2017-01-24 11:26       ` Bruce Richardson
2017-01-24 12:31         ` Robin Jarry
2017-01-24 11:40     ` Jerin Jacob
2017-01-24 12:15       ` Bruce Richardson
2017-01-24 12:56         ` Jerin Jacob
2017-01-24 13:26           ` Richardson, Bruce
2017-01-24 14:50             ` Olivier MATZ
2017-01-24 14:55               ` Wiles, Keith
2017-03-01 11:25                 ` Thomas Monjalon
2017-03-01 12:10                   ` Bruce Richardson
2017-03-01 12:30                   ` Olivier Matz
2017-01-24 13:05     ` Ferruh Yigit
2017-03-17 17:13     ` Olivier Matz
2017-03-17 17:47       ` Robin Jarry
2017-03-20  8:31         ` Olivier Matz
2017-03-24 13:21       ` [dpdk-dev] [PATCH v2] " Olivier Matz
2017-03-27 21:33         ` Thomas Monjalon
2017-03-28 10:34         ` Ferruh Yigit
2017-03-30  8:51           ` Olivier Matz
2017-03-30  9:27             ` Ferruh Yigit
2017-03-30 12:11               ` Olivier Matz
2017-03-30 12:32                 ` [dpdk-dev] [PATCH] mk: fix dependencies to optional configs Olivier Matz
2017-03-30 12:37                   ` Ferruh Yigit
2017-03-30 13:37                     ` Thomas Monjalon
2017-01-23 17:50   ` [dpdk-dev] [PATCH] mk: parallelize make config Wiles, Keith
2017-01-24  8:42     ` Olivier MATZ
2017-01-24 10:02       ` Bruce Richardson
2017-01-23 19:03 ` Michał Mirosław
2017-01-30  9:41   ` Ferruh Yigit
2017-01-24 10:52 ` Bruce Richardson
2017-01-29 15:29 ` Thomas Monjalon
2017-01-30  9:46   ` Ferruh Yigit
2017-01-30 10:21 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2017-01-30 18:13   ` 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).