summaryrefslogtreecommitdiffstats
path: root/src/spdk/dpdk/mk/rte.extsubdir.mk
diff options
context:
space:
mode:
Diffstat (limited to 'src/spdk/dpdk/mk/rte.extsubdir.mk')
-rw-r--r--src/spdk/dpdk/mk/rte.extsubdir.mk39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/spdk/dpdk/mk/rte.extsubdir.mk b/src/spdk/dpdk/mk/rte.extsubdir.mk
new file mode 100644
index 00000000..0f8ef94c
--- /dev/null
+++ b/src/spdk/dpdk/mk/rte.extsubdir.mk
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2014 6WIND S.A.
+
+MAKEFLAGS += --no-print-directory
+
+ALL_DEPDIRS := $(patsubst DEPDIRS-%,%,$(filter DEPDIRS-%,$(.VARIABLES)))
+
+# output directory
+O ?= $(CURDIR)
+BASE_OUTPUT ?= $(abspath $(O))
+CUR_SUBDIR ?= .
+
+.PHONY: all
+all: $(DIRS-y)
+
+.PHONY: clean
+clean: $(DIRS-y)
+
+.PHONY: $(DIRS-y)
+$(DIRS-y):
+ @echo "== $@"
+ $(Q)$(MAKE) -C $(@) \
+ M=$(CURDIR)/$(@)/Makefile \
+ O=$(BASE_OUTPUT)/$(CUR_SUBDIR)/$(@)/$(RTE_TARGET) \
+ BASE_OUTPUT=$(BASE_OUTPUT) \
+ CUR_SUBDIR=$(CUR_SUBDIR)/$(@) \
+ S=$(CURDIR)/$(@) \
+ $(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))))