Imported Upstream version 17.05
[deb_dpdk.git] / mk / rte.extsubdir.mk
index f50f006..d21791b 100644 (file)
 
 MAKEFLAGS += --no-print-directory
 
+ALL_DEPDIRS := $(patsubst DEPDIRS-%,%,$(filter DEPDIRS-%,$(.VARIABLES)))
+
 # output directory
-O ?= .
-BASE_OUTPUT ?= $(O)
+O ?= $(CURDIR)
+BASE_OUTPUT ?= $(abspath $(O))
 CUR_SUBDIR ?= .
 
 .PHONY: all
@@ -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))))