1 |
410
|
aaronmk
|
# Make
|
2 |
625
|
aaronmk
|
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 |
623
|
aaronmk
|
# input.Makefile path is relative to subdir
|
8 |
410
|
aaronmk
|
|
9 |
|
|
#####
|
10 |
|
|
|
11 |
|
|
all:
|
12 |
|
|
|
13 |
|
|
.SUFFIXES:
|
14 |
|
|
|
15 |
|
|
_always:
|
16 |
|
|
.PHONY: _always
|
17 |
|
|
|
18 |
623
|
aaronmk
|
subdirs := $(wildcard */)
|
19 |
|
|
|
20 |
410
|
aaronmk
|
define subdirTargets
|
21 |
|
|
$(subdir): _always
|
22 |
|
|
+$$(subMake)
|
23 |
|
|
|
24 |
|
|
$(subdir)%: _always
|
25 |
|
|
+$$(subMake)
|
26 |
|
|
endef
|
27 |
623
|
aaronmk
|
$(foreach subdir,$(subdirs),$(eval $(subdirTargets)))
|
28 |
410
|
aaronmk
|
|
29 |
416
|
aaronmk
|
Makefile: ;
|
30 |
|
|
|
31 |
623
|
aaronmk
|
%: $(addsuffix %,$(subdirs)) _always ;
|