]> git.rmz.io Git - dotfiles.git/blob - Makefile
zathura: configure zathura to use nord colors and dark pages by default
[dotfiles.git] / Makefile
1 APATH := $(realpath .)
2
3 XDG_CONFIG_HOME ?= ~/.config
4 XDG_CACHE_HOME ?= ~/.cache
5 XDG_DATA_HOME ?= ~/.local/share
6
7 FILES := bin
8 DOTFILES := goobookrc profile Xresources
9 CONFIGFILES := mpv offlineimap ranger retroarch xbindkeys xkb
10
11 .PHONY: core_files
12 core_files: dircolors git ranger ssh systemd tmux vim zsh
13
14 .PHONY: desktop
15 desktop: core_files awesome kitty picom qutebrowser rofi xkb
16
17 .PHONY: install $(FILES) $(DOTFILES) $(CONFIGFILES)
18 install: $(FILES) $(DOTFILES) $(CONFIGFILES)
19
20 $(XDG_DATA_HOME) $(XDG_CONFIG_HOME):
21 mkdir -p $@
22
23 awesome: $(XDG_CONFIG_HOME) xinit
24 ln -sfT $(APATH)/awesome $(XDG_CONFIG_HOME)/awesome
25 ln -sfT $(APATH)/zlogin ~/.zlogin
26 git submodule update --init \
27 awesome/widgets/pomodoro \
28 awesome/widgets/net_widgets
29 .PHONY: awesome
30
31 dircolors: $(XDG_CONFIG_HOME)
32 ln -sfT $(APATH)/dircolors $(XDG_CONFIG_HOME)/dircolors
33 .PHONY: dircolors
34
35 gdb:
36 mkdir $(XDG_DATA_HOME)/gdb
37 ln -sfT $(APATH)/gdb $(XDG_CONFIG_HOME)/gdb
38 ln -sfT $(APATH)/gdbinit ~/.gdbinit
39 .PHONY: gdb
40
41 git: $(XDG_CONFIG_HOME)
42 ln -sfT $(APATH)/git $(XDG_CONFIG_HOME)/git
43 ln -sfT $(APATH)/tig $(XDG_CONFIG_HOME)/tig
44 .PHONY: git
45
46 gnupg: systemd
47 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
48 chmod 700 $(XDG_CONFIG_HOME)/$@
49 systemctl --user enable gpg-agent.socket gpg-agent-extra.socket gpg-agent-browser.socket dirmngr.socket
50 systemctl --user start gpg-agent.socket gpg-agent-extra.socket gpg-agent-browser.socket dirmngr.socket
51 sudo ln -sfT $(APATH)/bin/pinentry /usr/local/bin/pinentry
52 .PHONY: gnupg
53
54 khal: $(XDG_CONFIG_HOME)
55 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
56 .PHONY: khal
57
58 khard: $(XDG_CONFIG_HOME)
59 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
60 .PHONY: khard
61
62 kitty:
63 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
64 .PHONY: kitty
65
66 mpd: systemd
67 ln -sfT $(APATH)/mpd $(XDG_CONFIG_HOME)/mpd
68 mkdir -p $(XDG_DATA_HOME)/mpd/playlists
69 systemctl --user enable mpd
70 systemctl --user start mpd
71 .PHONY: mpd
72
73 mbsync:
74 ln -sfT $(APATH)/mbsync $(XDG_CONFIG_HOME)/mbsync
75 .PHONY: mbsync
76
77 msmtp:
78 ln -sfT $(APATH)/msmtprc ~/.msmtprc
79 ln -sfT $(APATH)/msmtp ~/.msmtp
80 .PHONY: msmtp
81
82 mutt: $(XDG_CONFIG_HOME)
83 ln -sfT $(APATH)/mutt $(XDG_CONFIG_HOME)/mutt
84 .PHONY: mutt
85
86 mail: mbsync msmtp mutt
87 .PHONY: mail
88
89 ncmpcpp: $(XDG_CONFIG_HOME)
90 ln -sfT $(APATH)/ncmpcpp $(XDG_CONFIG_HOME)/ncmpcpp
91 mkdir -p $(XDG_DATA_HOME)/mpd/lyrics
92 .PHONY: ncmpcpp
93
94 pacman: $(XDG_CONFIG_HOME)
95 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
96 .PHONY: pacman
97
98 picom: $(XDG_CONFIG_HOME)
99 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
100 .PHONY: picom
101
102 qute_scripts := $(wildcard qutebrowser/userscripts/*)
103 $(qute_scripts):
104 mkdir -p $(XDG_DATA_HOME)/qutebrowser/userscripts
105 ln -sfT $(APATH)/$@ $(XDG_DATA_HOME)/$@
106 .PHONY: $(qute_scripts)
107
108 qutebrowser: $(XDG_CONFIG_HOME) $(qute_scripts)
109 ln -sfT $(APATH)/qutebrowser $(XDG_CONFIG_HOME)/qutebrowser
110 mkdir -p ~/downloads
111 .PHONY: qutebrowser
112
113 rofi: $(XDG_CONFIG_HOME)
114 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
115 .PHONY: rofi
116
117 ssh:
118 ln -sfT $(APATH)/ssh/config ~/.ssh/config
119 .PHONY: ssh
120
121 /etc/systemd/system/%: systemd/system/%
122 sudo ln -s $(APATH)/$< $@
123
124 systemd_system_units := $(patsubst %,/etc/%,$(wildcard systemd/system/*))
125 systemd: $(XDG_CONFIG_HOME) $(systemd_system_units)
126 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
127 .PHONY: systemd
128
129 task: $(XDG_CONFIG_HOME)
130 ln -sfT $(APATH)/taskrc $(XDG_CONFIG_HOME)/taskrc
131 .PHONY: task
132
133 tmux: $(XDG_CONFIG_HOME)
134 ln -sfT $(APATH)/tmux $(XDG_CONFIG_HOME)/tmux
135 git submodule update --init \
136 tmux/plugins/nord-tmux \
137 tmux/plugins/tpm
138 .PHONY: tmux
139
140 urxvt: $(XDG_CONFIG_HOME)
141 ln -sfT $(APATH)/urxvt $(XDG_CONFIG_HOME)/urxvt
142 .PHONY: urxvt
143
144 vdirsyncer: $(XDG_CACHE_HOME)
145 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
146 mkdir -p $(XDG_DATA_HOME)/vdirsyncer/{contacts,calendars}
147 .PHONY: vdirsyncer
148
149 vim: $(XDG_CONFIG_HOME)
150 ln -sfT $(APATH)/vim $(XDG_CONFIG_HOME)/vim
151 mkdir -p $(XDG_DATA_HOME)/vim
152 .PHONY: vim
153
154 yay: $(XDG_CONFIG_HOME)
155 ln -sfT $(APATH)/yay $(XDG_CONFIG_HOME)/yay
156 mkdir -p $(XDG_CACHE_HOME)/yay
157
158 xinit: $(XDG_CONFIG_HOME) xprofile
159 ln -sfT $(APATH)/$@rc ~/.$@rc
160 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
161 .PHONY: xinit
162
163 xprofile: $(XDG_CONFIG_HOME)
164 ln -sfT $(APATH)/$@ ~/.$@
165 ln -sfT $(APATH)/$@.d $(XDG_CONFIG_HOME)/$@.d
166 .PHONY: xprofile
167
168 wakeonlan: $(XDG_CONFIG_HOME)
169 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
170 .PHONY: wakeonlan
171
172 weechat: $(XDG_CONFIG_HOME) $(XDG_CACHE_HOME)
173 ln -sfT $(APATH)/weechat $(XDG_CONFIG_HOME)/weechat
174 mkdir -p $(XDG_CACHE_HOME)/weechat
175 .PHONY: weechat
176
177 zathura: $(XDG_CONFIG_HOME)
178 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
179 .PHONY: zathura
180
181 zsh: $(XDG_CONFIG_HOME)
182 ln -sfT $(APATH)/zshrc ~/.zshrc
183 ln -sfT $(APATH)/zshenv ~/.zshenv
184 ln -sfT $(APATH)/zsh $(XDG_CONFIG_HOME)/zsh
185 ln -sfT $(APATH)/aliases $(XDG_CONFIG_HOME)/aliases
186 mkdir -p $(XDG_CACHE_HOME)/zsh
187 mkdir -p $(XDG_DATA_HOME)/zsh
188 git submodule update --init zsh/lib/zsh-syntax-highlighting
189 .PHONY: zsh
190
191 $(FILES):
192 @if [[ -e ~/$@ && ! -L ~/$@ ]]; then \
193 if [[ -d $@ ]]; then \
194 cp -r ~/$@/* $@; \
195 else \
196 cp -r ~/$@ $@; \
197 fi; \
198 rm -r ~/$@; \
199 fi;
200 ln -sfT $(APATH)/$@ ~/$@
201
202 $(DOTFILES):
203 @if [[ -e ~/.$@ && ! -L ~/.$@ ]]; then \
204 if [[ -d .$@ ]]; then \
205 cp -r ~/.$@/* $@; \
206 else \
207 cp -r ~/.$@ $@; \
208 fi; \
209 rm -r ~/.$@; \
210 fi;
211 ln -sfT $(APATH)/$@ ~/.$@
212
213 $(CONFIGFILES): $(XDG_CONFIG_HOME)
214 @if [[ -e $(XDG_CONFIG_HOME)/$@ && ! -L $(XDG_CONFIG_HOME)/$@ ]]; then \
215 if [[ -d .config/$@ ]]; then \
216 cp -r $(XDG_CONFIG_HOME)/$@/* $@; \
217 else \
218 cp -r $(XDG_CONFIG_HOME)/$@ $@; \
219 fi; \
220 rm -r $(XDG_CONFIG_HOME)/$@; \
221 fi;
222 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@