1
|
# Make
|
2
|
pathParts = $(shell path="$(1)"; echo "$${path%%/*}" "$${path\#*/}")
|
3
|
topDir = $(firstword $(pathParts))
|
4
|
subPath = $(lastword $(pathParts))
|
5
|
subMake = $(MAKE) $(call subPath,$@) --directory=$(call topDir,$@) \
|
6
|
--makefile=../input.Makefile
|
7
|
# input.Makefile path is relative to subdir
|
8
|
|
9
|
#####
|
10
|
|
11
|
all:
|
12
|
|
13
|
.SUFFIXES:
|
14
|
|
15
|
_always:
|
16
|
.PHONY: _always
|
17
|
|
18
|
subdirs := $(wildcard */)
|
19
|
|
20
|
define subdirTargets
|
21
|
$(subdir): _always
|
22
|
+$$(subMake)
|
23
|
|
24
|
$(subdir)%: _always
|
25
|
+$$(subMake)
|
26
|
endef
|
27
|
$(foreach subdir,$(subdirs),$(eval $(subdirTargets)))
|
28
|
|
29
|
Makefile: ;
|
30
|
|
31
|
%: $(addsuffix %,$(subdirs)) _always ;
|