]> git.rmz.io Git - dotfiles.git/blob - Makefile
nvim/ui: add blank plugin specs for all plugins
[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: $(XDG_CACHE_HOME) $(XDG_DATA_HOME)
36 mkdir $(XDG_DATA_HOME)/gdb
37 ln -sfT $(APATH)/gdb $(XDG_CONFIG_HOME)/gdb
38 .PHONY: gdb
39
40 git: $(XDG_CONFIG_HOME)
41 ln -sfT $(APATH)/git $(XDG_CONFIG_HOME)/git
42 ln -sfT $(APATH)/tig $(XDG_CONFIG_HOME)/tig
43 .PHONY: git
44
45 gnupg: systemd
46 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
47 chmod 700 $(XDG_CONFIG_HOME)/$@
48 systemctl --user enable gpg-agent.socket gpg-agent-extra.socket gpg-agent-browser.socket dirmngr.socket
49 systemctl --user start gpg-agent.socket gpg-agent-extra.socket gpg-agent-browser.socket dirmngr.socket
50 sudo ln -sfT $(APATH)/bin/pinentry /usr/local/bin/pinentry
51 .PHONY: gnupg
52
53 khal: $(XDG_CONFIG_HOME)
54 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
55 .PHONY: khal
56
57 khard: $(XDG_CONFIG_HOME)
58 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
59 .PHONY: khard
60
61 kitty:
62 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
63 .PHONY: kitty
64
65 mpd: systemd
66 ln -sfT $(APATH)/mpd $(XDG_CONFIG_HOME)/mpd
67 mkdir -p $(XDG_DATA_HOME)/mpd/playlists
68 systemctl --user enable mpd
69 systemctl --user start mpd
70 .PHONY: mpd
71
72 mbsync:
73 ln -sfT $(APATH)/mbsync $(XDG_CONFIG_HOME)/mbsync
74 .PHONY: mbsync
75
76 msmtp:
77 ln -sfT $(APATH)/msmtprc ~/.msmtprc
78 ln -sfT $(APATH)/msmtp ~/.msmtp
79 .PHONY: msmtp
80
81 mutt: $(XDG_CONFIG_HOME)
82 ln -sfT $(APATH)/mutt $(XDG_CONFIG_HOME)/mutt
83 .PHONY: mutt
84
85 mail: mbsync msmtp mutt
86 .PHONY: mail
87
88 ncmpcpp: $(XDG_CONFIG_HOME)
89 ln -sfT $(APATH)/ncmpcpp $(XDG_CONFIG_HOME)/ncmpcpp
90 mkdir -p $(XDG_DATA_HOME)/mpd/lyrics
91 .PHONY: ncmpcpp
92
93 pacman: $(XDG_CONFIG_HOME)
94 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
95 .PHONY: pacman
96
97 picom: $(XDG_CONFIG_HOME)
98 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
99 .PHONY: picom
100
101 qute_scripts := $(wildcard qutebrowser/userscripts/*)
102 $(qute_scripts):
103 mkdir -p $(XDG_DATA_HOME)/qutebrowser/userscripts
104 ln -sfT $(APATH)/$@ $(XDG_DATA_HOME)/$@
105 .PHONY: $(qute_scripts)
106
107 qutebrowser: $(XDG_CONFIG_HOME) $(qute_scripts)
108 ln -sfT $(APATH)/qutebrowser $(XDG_CONFIG_HOME)/qutebrowser
109 mkdir -p ~/downloads
110 .PHONY: qutebrowser
111
112 rofi: $(XDG_CONFIG_HOME)
113 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
114 .PHONY: rofi
115
116 ssh:
117 ln -sfT $(APATH)/ssh/config ~/.ssh/config
118 .PHONY: ssh
119
120 # copy system files, do not link, it doesn't work if home is encrypted
121 /etc/systemd/system/%: systemd/system/%
122 sudo cp $(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)/$@ $(XDG_CONFIG_HOME)/$@
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 zellij: $(XDG_CONFIG_HOME)
182 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
183 .PHONY: zellij
184
185 zsh: $(XDG_CONFIG_HOME)
186 ln -sfT $(APATH)/zshrc ~/.zshrc
187 ln -sfT $(APATH)/zshenv ~/.zshenv
188 ln -sfT $(APATH)/zsh $(XDG_CONFIG_HOME)/zsh
189 ln -sfT $(APATH)/aliases $(XDG_CONFIG_HOME)/aliases
190 mkdir -p $(XDG_CACHE_HOME)/zsh
191 mkdir -p $(XDG_DATA_HOME)/zsh
192 git submodule update --init zsh/lib/zsh-syntax-highlighting
193 .PHONY: zsh
194
195 $(FILES):
196 @if [[ -e ~/$@ && ! -L ~/$@ ]]; then \
197 if [[ -d $@ ]]; then \
198 cp -r ~/$@/* $@; \
199 else \
200 cp -r ~/$@ $@; \
201 fi; \
202 rm -r ~/$@; \
203 fi;
204 ln -sfT $(APATH)/$@ ~/$@
205
206 $(DOTFILES):
207 @if [[ -e ~/.$@ && ! -L ~/.$@ ]]; then \
208 if [[ -d .$@ ]]; then \
209 cp -r ~/.$@/* $@; \
210 else \
211 cp -r ~/.$@ $@; \
212 fi; \
213 rm -r ~/.$@; \
214 fi;
215 ln -sfT $(APATH)/$@ ~/.$@
216
217 $(CONFIGFILES): $(XDG_CONFIG_HOME)
218 @if [[ -e $(XDG_CONFIG_HOME)/$@ && ! -L $(XDG_CONFIG_HOME)/$@ ]]; then \
219 if [[ -d .config/$@ ]]; then \
220 cp -r $(XDG_CONFIG_HOME)/$@/* $@; \
221 else \
222 cp -r $(XDG_CONFIG_HOME)/$@ $@; \
223 fi; \
224 rm -r $(XDG_CONFIG_HOME)/$@; \
225 fi;
226 ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@