Project

General

Profile

« Previous | Next » 

Revision 3697

Moved generally useful targets and vars from inputs/Makefile to lib/common.Makefile and lib/forwarding.Makefile

View differences:

inputs/Makefile
1
##### Configuration
1
include ../lib/common.Makefile
2 2

  
3
src_server ?= vegbiendev
4
src_user ?= $(USER)
5
test ?=
6 3

  
7
##### Vars/functions
8

  
9
# Make
10
pathParts = $(shell path="$(1)"; echo "$${path%%/*}" "$${path\#*/}")
11
topDir = $(word 1,$(pathParts))
12
subPath = $(word 2,$(pathParts))
13
subMake = $(MAKE) $(call subPath,$@) --directory=$(call topDir,$@) \
14
--makefile=../input.Makefile
15
# input.Makefile path is relative to subdir
16

  
17
# SVN
18
addDir = $(if $(wildcard $(1)/),svn add --depth=empty $(1),svn mkdir $(1))
19

  
20
# rsync
21
rsync := rsync$(if $(test), --dry-run) --archive --update --verbose\
22
--itemize-changes --progress --exclude=".*"
23
local := ./
24
remote := $(src_user)@$(src_server):/home/bien/svn/inputs/
25

  
26
##### General targets
27

  
28
all:
29

  
30
.SUFFIXES: # turn off built-in suffix rules
31
.SECONDARY: # don't automatically delete intermediate files
32
.DELETE_ON_ERROR: # delete target if recipe fails
33

  
34
_always:
35
.PHONY: _always
36

  
37 4
##### SVN
38 5

  
39 6
# Adds a new datasource
......
52 19
download: _always
53 20
	$(rsyncSrcs) $(remote) $(local)
54 21

  
55
##### Subdir forwarding
56 22

  
57
subdirs := $(wildcard */)
58

  
59
define subdirTargets
60
$(subdir): _always
61
	+$$(subMake)
62

  
63
$(subdir)%: _always
64
	+$$(subMake)
65
.PRECIOUS: $(subdir)% # let subdir's Makefile decide whether to delete on error
66
endef
67
$(foreach subdir,$(subdirs),$(eval $(subdirTargets)))
68

  
69
Makefile: ;
70

  
71
%: $(addsuffix %,$(subdirs)) _always ;
23
include ../lib/forwarding.Makefile
lib/common.Makefile
1
##### Configuration
2

  
3
src_server ?= vegbiendev
4
src_user ?= $(USER)
5
test ?=
6

  
7
##### Vars/functions
8

  
9
# Make
10
pathParts = $(shell path="$(1)"; echo "$${path%%/*}" "$${path\#*/}")
11
topDir = $(word 1,$(pathParts))
12
subPath = $(word 2,$(pathParts))
13
subMake = $(MAKE) $(call subPath,$@) --directory=$(call topDir,$@) \
14
--makefile=../input.Makefile
15
# input.Makefile path is relative to subdir
16

  
17
# SVN
18
addDir = $(if $(wildcard $(1)/),svn add --depth=empty $(1),svn mkdir $(1))
19

  
20
# rsync
21
rsync := rsync$(if $(test), --dry-run) --archive --update --verbose\
22
--itemize-changes --progress --exclude=".*"
23
local := ./
24
remote := $(src_user)@$(src_server):/home/bien/svn/inputs/
25

  
26
##### General targets
27

  
28
all:
29

  
30
.SUFFIXES: # turn off built-in suffix rules
31
.SECONDARY: # don't automatically delete intermediate files
32
.DELETE_ON_ERROR: # delete target if recipe fails
33

  
34
_always:
35
.PHONY: _always
lib/forwarding.Makefile
1
##### Subdir forwarding
2

  
3
subdirs := $(wildcard */)
4

  
5
define subdirTargets
6
$(subdir): _always
7
	+$$(subMake)
8

  
9
$(subdir)%: _always
10
	+$$(subMake)
11
.PRECIOUS: $(subdir)% # let subdir's Makefile decide whether to delete on error
12
endef
13
$(foreach subdir,$(subdirs),$(eval $(subdirTargets)))
14

  
15
Makefile: ;
16

  
17
%: $(addsuffix %,$(subdirs)) _always ;

Also available in: Unified diff