summaryrefslogtreecommitdiff
path: root/subdirs.mk
blob: b742d75abd6edb63cd1a1a77d0cd0d8d19d9edde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- make -*-

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

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)