summaryrefslogtreecommitdiff
path: root/subdirs.mk
diff options
context:
space:
mode:
Diffstat (limited to 'subdirs.mk')
-rw-r--r--subdirs.mk9
1 files changed, 9 insertions, 0 deletions
diff --git a/subdirs.mk b/subdirs.mk
index a39b038..b742d75 100644
--- a/subdirs.mk
+++ b/subdirs.mk
@@ -2,6 +2,11 @@
export dir_symbol += -
+USE_ABSOLUTE_TOPDIR ?= 0
+ifneq ($(USE_ABSOLUTE_TOPDIR),0)
+ TOPDIR_FOR_SUBDIR=$(shell pwd)
+endif
+
nullstring :=
space := $(nullstring) # keep it to assign space
@@ -9,6 +14,10 @@ subdirs: $(SUBDIRS)
$(SUBDIRS):
echo $(subst $(space),,$(dir_symbol))'|' $@ $(MAKECMDGOALS)
+ifeq ($(USE_ABSOLUTE_TOPDIR),0)
$(MAKE) -C $@ $(MAKECMDGOALS)
+else
+ TOPDIR="$(TOPDIR_FOR_SUBDIR)" $(MAKE) -C $@ $(MAKECMDGOALS)
+endif
.PHONY: $(SUBDIRS)