-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
116 lines (100 loc) · 3.5 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
SUBDIRS = awesome qutebrowser vim ncmpcpp beets ranger mutt
ZSH_CONFIG = \
zsh/zshrc.debian \
zsh/zshrc.env \
zsh/zshrc.local \
zsh/zshrc.fzf \
zsh/zshrc.wine \
zsh/zshrc.wine \
zsh/zshrc.alias
XDG_CONFIG_CONTENT = \
config/zathura/zathurarc\
config/mpd/mpd.conf\
config/mpv/input.conf\
config/systemd/user/mbsync.timer\
config/systemd/user/mbsync.service\
config/systemd/user/notmuch.service\
config/systemd/user/redshift.service.d/override.conf\
config/systemd/user/[email protected]\
config/systemd/user/conky.target\
config/systemd/user/keynav.service\
config/systemd/user/ipfs.service\
config/environment.d/path.conf\
config/imv/config\
config/swayr/config.toml\
config/wofi/style.css\
config/sway/config\
$(wildcard config/sway/config.d/*) \
config/swaylock/config
DOTFILES = gitconfig\
vimrc\
Xresources\
taskrc\
tigrc\
Xmodmap\
gbp.conf\
mbsyncrc\
zshrc\
zplug\
conky\
keynavrc\
fzf_env\
gnupg/gpg-agent.conf\
xkb/symbols/ca-multix-sim590
BIN_FILES = bin/lights\
bin/pinentry-rofi.scm\
bin/setkeyboard\
bin/udev-setkeyboard\
bin/setwallpaper\
bin/wmake\
bin/rofi\
bin/pqutebrowser\
bin/sesame-ouvre-toi
ZSH_DEST_LINKS = $(addprefix $(HOME)/.,$(subst zsh/,,${ZSH_CONFIG}))
XDG_CONFIG_DEST_LINKS = $(addprefix $(HOME)/.,${XDG_CONFIG_CONTENT})
DOTFILES_DEST_LINKS = $(addprefix $(HOME)/.,$(DOTFILES))
BIN_DEST_LINKS = $(addprefix $(HOME)/,$(BIN_FILES))
DEST_LINKS = ${ZSH_DEST_LINKS} \
${XDG_CONFIG_DEST_LINKS} \
${DOTFILES_DEST_LINKS} \
${BIN_DEST_LINKS}
CONFIG_FILES = $(shell git ls-tree --full-tree -r @ | grep -e 'blob.*[a-zA-Z]\+\.in' | gawk '{print $$4}')
CONFIG_OUT = $(CONFIG_FILES:.in=)
.PHONY: all links subdirs clean
all: configure links subdirs
help: ## Prints help for targets with comments
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
configure: $(CONFIG_OUT) ## Configure all the files (strings substitutions)
$(CONFIG_OUT): $(CONFIG_FILES)
m4 $(foreach def,$(M4_DEFINE),-D$(def)) macros.m4 [email protected] > $@
chmod $(if $(findstring bin/,$@),755,644) $@
links: dirs $(DEST_LINKS) ## Produce all symlinks on system
dirs:
mkdir -p $(dir $(DEST_LINKS))
define MAKE_LINKS
$(1): $(2)
ln -s $$(CURDIR)/$$< $$@ ; true
endef
$(eval $(call MAKE_LINKS,$(HOME)/.%, %))
$(eval $(call MAKE_LINKS,$(HOME)/.%, zsh/%))
$(eval $(call MAKE_LINKS,$(HOME)/bin/%, bin/%))
$(HOME)/.oh-my-zsh:
rm -rf ~/.oh-my-zsh
sh -c "$$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --unattended"
echo "source $$HOME/.zshrc.local" >> $$HOME/.zshrc
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $${ZSH_CUSTOM:-$(HOME)/.oh-my-zsh/custom}/themes/powerlevel10k
@echo "Theme powerlevel10k has been installed. It needs to be enabled and configured. See ZSH_THEME variable in ~/.zshrc..."
zshrc: $(HOME)/.oh-my-zsh
subdirs:
@for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir; \
done
clean-config: ## Clean configured files (result of m4 processing)
rm -f $(CONFIG_OUT)
clean-links: ## Clean links on the system
rm -ir $(DEST_LINKS) ; true
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir clean; \
done
clean: clean-links clean-config ## Clean all
# vim:set noet sts=0 sw=2 ts=2 tw=80: