1 |
3697
|
aaronmk
|
##### Configuration
|
2 |
|
|
|
3 |
|
|
src_server ?= vegbiendev
|
4 |
|
|
src_user ?= $(USER)
|
5 |
|
|
test ?=
|
6 |
|
|
|
7 |
|
|
##### Vars/functions
|
8 |
|
|
|
9 |
|
|
# Make
|
10 |
3763
|
aaronmk
|
null :=
|
11 |
|
|
space := $(null) $(null)
|
12 |
3697
|
aaronmk
|
pathParts = $(shell path="$(1)"; echo "$${path%%/*}" "$${path\#*/}")
|
13 |
|
|
topDir = $(word 1,$(pathParts))
|
14 |
|
|
subPath = $(word 2,$(pathParts))
|
15 |
|
|
subMake = $(MAKE) $(call subPath,$@) --directory=$(call topDir,$@) \
|
16 |
|
|
--makefile=../input.Makefile
|
17 |
|
|
# input.Makefile path is relative to subdir
|
18 |
|
|
|
19 |
3763
|
aaronmk
|
# Formatting
|
20 |
|
|
_2Space = $(subst _,$(space),$(1))
|
21 |
|
|
*2Space = $(call _2Space,$*)
|
22 |
|
|
|
23 |
3792
|
aaronmk
|
# Filesystem
|
24 |
3794
|
aaronmk
|
CP := cp -p
|
25 |
|
|
cp = $(CP) $< $@
|
26 |
3792
|
aaronmk
|
|
27 |
3697
|
aaronmk
|
# SVN
|
28 |
|
|
addDir = $(if $(wildcard $(1)/),svn add --depth=empty $(1),svn mkdir $(1))
|
29 |
|
|
|
30 |
|
|
# rsync
|
31 |
3756
|
aaronmk
|
rsync := "time" rsync$(if $(test), --dry-run) --archive --update --verbose\
|
32 |
3697
|
aaronmk
|
--itemize-changes --progress --exclude=".*"
|
33 |
|
|
local := ./
|
34 |
3700
|
aaronmk
|
localDirName := $(notdir $(realpath $(local)))
|
35 |
|
|
remote := $(src_user)@$(src_server):/home/bien/svn/$(localDirName)/
|
36 |
3697
|
aaronmk
|
|
37 |
|
|
##### General targets
|
38 |
|
|
|
39 |
3765
|
aaronmk
|
all: # must be first target in Makefile, so add an empty version here
|
40 |
3697
|
aaronmk
|
|
41 |
|
|
.SUFFIXES: # turn off built-in suffix rules
|
42 |
|
|
.SECONDARY: # don't automatically delete intermediate files
|
43 |
|
|
.DELETE_ON_ERROR: # delete target if recipe fails
|
44 |
|
|
|
45 |
|
|
_always:
|
46 |
|
|
.PHONY: _always
|
47 |
3765
|
aaronmk
|
|
48 |
|
|
clean: # make sure `make clean` always works
|