summaryrefslogtreecommitdiff
path: root/subdirs.mk
blob: 1491144800ecfe7de186485c0db225c0b2443918 (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)
	[ -d $@ ] && $(MAKE) -C $@ $(MAKECMDGOALS) || echo no subdir $@
else
	[ -d $@ ] && TOPDIR="$(TOPDIR_FOR_SUBDIR)" $(MAKE) -C $@ $(MAKECMDGOALS) || echo no subdir $@
endif

.PHONY: $(SUBDIRS)