1 |
785
|
aaronmk
|
##### Vars/functions
|
2 |
|
|
|
3 |
410
|
aaronmk
|
# Make
|
4 |
625
|
aaronmk
|
pathParts = $(shell path="$(1)"; echo "$${path%%/*}" "$${path\#*/}")
|
5 |
874
|
aaronmk
|
topDir = $(word 1,$(pathParts))
|
6 |
|
|
subPath = $(word 2,$(pathParts))
|
7 |
625
|
aaronmk
|
subMake = $(MAKE) $(call subPath,$@) --directory=$(call topDir,$@) \
|
8 |
|
|
--makefile=../input.Makefile
|
9 |
623
|
aaronmk
|
# input.Makefile path is relative to subdir
|
10 |
410
|
aaronmk
|
|
11 |
785
|
aaronmk
|
##### General targets
|
12 |
410
|
aaronmk
|
|
13 |
|
|
all:
|
14 |
|
|
|
15 |
1260
|
aaronmk
|
.SUFFIXES: # turn off built-in suffix rules
|
16 |
|
|
.SECONDARY: # don't automatically delete intermediate files
|
17 |
1354
|
aaronmk
|
.DELETE_ON_ERROR: # delete target if recipe fails
|
18 |
410
|
aaronmk
|
|
19 |
|
|
_always:
|
20 |
|
|
.PHONY: _always
|
21 |
|
|
|
22 |
623
|
aaronmk
|
subdirs := $(wildcard */)
|
23 |
|
|
|
24 |
410
|
aaronmk
|
define subdirTargets
|
25 |
|
|
$(subdir): _always
|
26 |
|
|
+$$(subMake)
|
27 |
|
|
|
28 |
|
|
$(subdir)%: _always
|
29 |
|
|
+$$(subMake)
|
30 |
|
|
endef
|
31 |
623
|
aaronmk
|
$(foreach subdir,$(subdirs),$(eval $(subdirTargets)))
|
32 |
410
|
aaronmk
|
|
33 |
416
|
aaronmk
|
Makefile: ;
|
34 |
|
|
|
35 |
623
|
aaronmk
|
%: $(addsuffix %,$(subdirs)) _always ;
|
36 |
767
|
aaronmk
|
|
37 |
785
|
aaronmk
|
##### SVN
|
38 |
767
|
aaronmk
|
|
39 |
|
|
%-add: _always
|
40 |
|
|
svn mkdir $*
|
41 |
|
|
$(MAKE) $*/svn_props
|