]> git.droids-corp.org - dpdk.git/blobdiff - mk/rte.extsubdir.mk
mk: optimize directory dependencies
[dpdk.git] / mk / rte.extsubdir.mk
index f50f0062bb46495d18484d3b9eaf8411e06016bb..3e733d826ae4cd81047fb52e917e50a338e11390 100644 (file)
@@ -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))))