-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (64 loc) · 1.68 KB
/
Makefile
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
PREFIX =# $(abspath ./test)
CWD = $(abspath ./)
REVERSE = no
ifeq ($(REVERSE),yes)
LN = set -x; _rm() { \
if ! [ -L $(PREFIX)/$$2 ]; then \
return; \
else \
rm $(PREFIX)/$$2; \
fi \
}; _rm
PP = set -x; _rm() { \
rm $(PREFIX)/$$2; \
}; _rm
else
LN = set -x; _ln() { \
mkdir -p '$(PREFIX)'"/$$(dirname $$2)" && \
ln -sfn $$1 $(PREFIX)/$$2; \
}; _ln
PP = set -x; _esh() { \
mkdir -p '$(PREFIX)'"/$$(dirname $$2)" && \
$(CWD)/esh -o $(PREFIX)/$$2 -- $$1 $(TMPL_VARS); \
}; _esh
endif
TMPL_VARS = XDGC=$(XDGC) XDGD=$(XDGD) LOGH=$(LOGH) \
XDGCACHE=$(XDGCACHE) XDG_RUNTIME_DIR=$(XDG_RUNTIME_DIR)
OS = $(shell uname -s)
HOSTNAME = $(shell hostname)
USER = $(shell whoami)
ifeq ($(HOSTNAME),jv-mbam2.local)
XDGC = $(HOME)/etc
XDGD = $(HOME)/.local/share
LOGH = $(HOME)/.local/var/log
XDGCACHE = $(HOME)/.local/var/cache
XDG_RUNTIME_DIR = /tmp/javyre
XDGC_LINKS = nvim tmux
TASKS = rc bin alacritty xdgc_links launchd_rc
endif
DIRS = $(XDGC) $(XDGD) $(LOGH) $(XDGCACHE) $(XDG_RUNTIME_DIR)
.PHONY: default
default: $(TASKS)
esh:
wget https://raw.githubusercontent.com/jirutka/esh/v0.3.2/esh
chmod u+x esh
.PHONY: rc
.PHONY: launchd_rc
.PHONY: bin
.PHONY: xdgc
.PHONY: alacritty
.PHONY: $(XDGC_LINKS)
.PHONY: xdgc_link
rc: esh
$(PP) $(CWD)/shell/rc $(XDGC)/shell/rc
$(PP) $(CWD)/shell/base-dirs.sh $(XDGC)/shell/base-dirs.sh
$(LN) $(CWD)/shell/rc.d $(XDGC)/shell/rc.d
launchd_rc: esh rc
$(PP) $(CWD)/jv-rc.plist $(HOME)/Library/LaunchAgents/jv-rc.plist
bin: rc
$(LN) $(CWD)/s $(HOME)/.local/bin/s
alacritty: esh rc
$(PP) $(CWD)/alacritty.yml $(XDGC)/alacritty.yml
$(XDGC_LINKS):
$(LN) $(CWD)/$@ $(XDGC)/$@
xdgc_links: $(XDGC_LINKS)