-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathMakefile
69 lines (53 loc) · 1.61 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
THEME_FILE = .themes/background
TEMPLATED_FILES = .tigrc \
.tmux.conf \
.Xdefaults \
.config/kitty/kitty.conf \
.newsboat/config \
.PHONY: all
all: stow theme
#-----------------------------------------------------------------------------
# stow
#-----------------------------------------------------------------------------
.PHONY: stow
stow: opt/symlink/
$(MAKE) -C $<
#-----------------------------------------------------------------------------
# template
#-----------------------------------------------------------------------------
define RENDER_TEMPLATE_TASK =
$(1): $(1).erb $(THEME_FILE)
env THEME=`cat $(THEME_FILE)` \
erb $(1).erb > $(1)
test -s $(1) || rm $(1)
endef
$(foreach t,$(TEMPLATED_FILES),$(eval $(call RENDER_TEMPLATE_TASK,$(t))))
#-----------------------------------------------------------------------------
# theme
#-----------------------------------------------------------------------------
$(THEME_FILE):
@echo 'Usage: make <dark|light>' >&2; false
.PHONY: dark
dark:
echo $@ > $(THEME_FILE)
$(MAKE) theme
.PHONY: light
light:
echo $@ > $(THEME_FILE)
$(MAKE) theme
.PHONY: theme
theme: theme-xrdb theme-tmux $(TEMPLATED_FILES)
.PHONY: theme-xrdb
theme-xrdb: .Xdefaults
if test -n "$$DISPLAY"; then xrdb -merge $<; fi
-killall -USR1 st
.config/kitty/kitty.conf: .Xdefaults
.Xdefaults: .Xdefaults.d/*.xrdb .Xdefaults.d/*/*.xrdb
.PHONY: theme-tmux
theme-tmux: .tmux.conf .tmux/plugins/tpm
if test -n "$$TMUX"; then tmux source $<; fi
.tmux/plugins/tpm:
git clone https://github.com/tmux-plugins/tpm $@
.PHONY: clean
clean:
find $(TEMPLATED_FILES) -size 0 -exec rm -v {} \;