1
|
##### Vars/functions
|
2
|
|
3
|
# Make
|
4
|
pathParts = $(shell path="$(1)"; echo "$${path%%/*}" "$${path\#*/}")
|
5
|
topDir = $(word 1,$(pathParts))
|
6
|
subPath = $(word 2,$(pathParts))
|
7
|
subMake = $(MAKE) $(call subPath,$@) --directory=$(call topDir,$@) \
|
8
|
--makefile=../input.Makefile
|
9
|
# input.Makefile path is relative to subdir
|
10
|
|
11
|
# SVN
|
12
|
svnMkdir = $(if $(wildcard $(1)/),,svn mkdir $(1))
|
13
|
|
14
|
##### General targets
|
15
|
|
16
|
all:
|
17
|
|
18
|
.SUFFIXES: # turn off built-in suffix rules
|
19
|
.SECONDARY: # don't automatically delete intermediate files
|
20
|
.DELETE_ON_ERROR: # delete target if recipe fails
|
21
|
|
22
|
_always:
|
23
|
.PHONY: _always
|
24
|
|
25
|
##### SVN
|
26
|
|
27
|
# Adds a new datasource
|
28
|
define add
|
29
|
$(call svnMkdir,$*)
|
30
|
$(call svnMkdir,$*/src)
|
31
|
$(call svnMkdir,$*/maps)
|
32
|
$(call svnMkdir,$*/verify)
|
33
|
$(call svnMkdir,$*/test)
|
34
|
$(MAKE) $*/svn_props
|
35
|
endef
|
36
|
|
37
|
# Must come before $(subdir)% to override it
|
38
|
%/-add: _always # to re-add existing dirs
|
39
|
$(add)
|
40
|
%-add: _always
|
41
|
$(add)
|
42
|
|
43
|
##### Subdir forwarding
|
44
|
|
45
|
subdirs := $(wildcard */)
|
46
|
|
47
|
define subdirTargets
|
48
|
$(subdir): _always
|
49
|
+$$(subMake)
|
50
|
|
51
|
$(subdir)%: _always
|
52
|
+$$(subMake)
|
53
|
endef
|
54
|
$(foreach subdir,$(subdirs),$(eval $(subdirTargets)))
|
55
|
|
56
|
Makefile: ;
|
57
|
|
58
|
%: $(addsuffix %,$(subdirs)) _always ;
|