1
|
##### Configuration
|
2
|
|
3
|
src_server ?= vegbiendev
|
4
|
src_user ?= $(USER)
|
5
|
test ?=
|
6
|
|
7
|
##### Vars/functions
|
8
|
|
9
|
# Make
|
10
|
null :=
|
11
|
space := $(null) $(null)
|
12
|
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
|
# Formatting
|
20
|
_2Space = $(subst _,$(space),$(1))
|
21
|
*2Space = $(call _2Space,$*)
|
22
|
|
23
|
# Filesystem
|
24
|
wildcard/ = $(shell echo $(1)|grep -vF '*')# emulate `shopt -s nullglob`
|
25
|
# needed because builtin $(wildcard) doesn't do / suffix correctly
|
26
|
no/ = $(1:/=)# remove trailing /
|
27
|
CP := cp -p
|
28
|
cp = $(CP) $< $@
|
29
|
|
30
|
# SVN
|
31
|
addFile = $(if $(wildcard $(1)),,touch $(1) && )svn add $(1)
|
32
|
addDir = $(if $(wildcard $(1)/),svn add --depth=empty $(1),svn mkdir $(1))
|
33
|
|
34
|
# rsync
|
35
|
rsync := "time" rsync$(if $(test), --dry-run) --archive --update --verbose\
|
36
|
--itemize-changes --progress --exclude=".*"
|
37
|
local := ./
|
38
|
localDirName := $(notdir $(realpath $(local)))
|
39
|
remote := $(src_user)@$(src_server):/home/bien/svn/$(localDirName)/
|
40
|
|
41
|
##### General targets
|
42
|
|
43
|
all: # must be first target in Makefile, so add an empty version here
|
44
|
|
45
|
.SUFFIXES: # turn off built-in suffix rules
|
46
|
.SECONDARY: # don't automatically delete intermediate files
|
47
|
.DELETE_ON_ERROR: # delete target if recipe fails
|
48
|
|
49
|
_always:
|
50
|
.PHONY: _always
|
51
|
|
52
|
clean: # make sure `make clean` always works
|