From f08649b6aa6c359c0ed5903c5809a8e7dfbf83b0 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Sat, 29 Aug 2020 22:58:58 -0400 Subject: allow to pass absolute topdir to subdirs targets --- subdirs.mk | 9 +++++++++ 1 file changed, 9 insertions(+) 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) -- cgit v1.2.3