-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (28 loc) · 980 Bytes
/
Makefile
File metadata and controls
39 lines (28 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# GNU Make version >= 3.82
configs := .gitconfig .vimrc .tmux.conf .inputrc $(wildcard .tmuxinator/*)
targets := $(addprefix $(HOME)/,$(configs))
dirs := .tmuxinator
tgtdirs := $(addprefix $(HOME)/,$(dirs))
.ONESHELL:
.SHELLFLAGS := -ec
all: install
pre-git:
sed -i.bak -E -e 's/(([0-9]{1,3}\.){3}[0-9]{1,3})(:[0-9]+)?/IP\3/g' -e 's/IP:[0-9]+/IP:PORT/g' .gitconfig
post-git:
IP=$$(sed -n -E 's/^.*[^0-9](([0-9]{1,3}\.){3}[0-9]{1,3}).*$$/\1/p' .gitconfig.bak | uniq)
PORT=$$(sed -n -E 's/^.*[^0-9](([0-9]{1,3}\.){3}[0-9]{1,3}):([0-9]+).*$$/\3/p' .gitconfig.bak | uniq)
printf "IP:PORT=$${IP}:$$PORT\n"
[ -z "$$IP" -o -z "$$PORT" ] && { echo "no IP or PORT" && exit 1; }
sed -i -E -e "s/IP/$$IP/g" -e "s/PORT/$$PORT/g" .gitconfig
$(targets): $(HOME)/%: %
ln -sf `realpath $<` $@
$(targets): | $(tgtdirs)
$(tgtdirs):
mkdir $@
install: $(targets)
push:
git push
git push utapp
clean:
rm -rf $(targets) $(tgtdirs)
.PHONY: all pre-git post-git install push clean