-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
437 lines (358 loc) · 12.7 KB
/
Makefile
File metadata and controls
437 lines (358 loc) · 12.7 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
RED := \033[0;31m
GREEN := \033[0;32m
YELLOW := \033[0;33m
BLUE := \033[0;34m
MAGENTA := \033[0;35m
CYAN := \033[0;36m
WHITE := \033[0;37m
END := \033[0m
INFO := $(BLUE)
WARN := $(YELLOW)
ERROR := $(RED)
MACOS := $(shell uname -s | grep Darwin 2> /dev/null)
HOMEBREW_PREFIX := $(shell brew --prefix 2> /dev/null)
log = @echo "$(INFO)$(1)$(END)"
err = @>&2 echo "$(ERROR)$(1)$(END)"
done = $(call log,"Done!")
run = @$(1) || (n=$$?; >&2 echo "$(ERROR)Failed!$(END)"; exit $$n)
### mkdirs
~/.%:
$(call log,"Creating dir $@...")
@mkdir -p $@
### laserwave
LASERWAVE_URL := https://raw.githubusercontent.com/lettertwo/laserwave.nvim/main/dist
.PHONY: laserwave
laserwave: ~/.config/kitty/laserwave.conf \
~/.config/bat/themes/laserwave.tmTheme \
~/.config/git/laserwave.gitconfig \
~/.config/yazi/flavors/laserwave.yazi/flavor.toml \
~/.config/ghostty/themes/laserwave
.PHONY: update-laserwave
update-laserwave:
$(call log,"Updating laserwave...")
@rm -f ~/.config/kitty/laserwave.conf ~/.config/bat/themes/laserwave.tmTheme ~/.config/git/laserwave.gitconfig ~/.config/ghostty/themes/laserwave
@rm -rf ~/.config/yazi/flavors/laserwave.yazi
$(call run,curl -fsSL $(LASERWAVE_URL)/kitty/laserwave.conf -o ~/.config/kitty/laserwave.conf)
$(call run,curl -fsSL $(LASERWAVE_URL)/laserwave.tmTheme -o ~/.config/bat/themes/laserwave.tmTheme)
$(call run,curl -fsSL $(LASERWAVE_URL)/delta/laserwave.gitconfig -o ~/.config/git/laserwave.gitconfig)
$(call run,mkdir -p ~/.config/yazi/flavors/laserwave.yazi)
$(call run,curl -fsSL $(LASERWAVE_URL)/yazi/laserwave.yazi/flavor.toml -o ~/.config/yazi/flavors/laserwave.yazi/flavor.toml)
$(call run,curl -fsSL $(LASERWAVE_URL)/yazi/laserwave.yazi/tmtheme.xml -o ~/.config/yazi/flavors/laserwave.yazi/tmtheme.xml)
$(call run,curl -fsSL $(LASERWAVE_URL)/ghostty/laserwave -o ~/.config/ghostty/themes/laserwave)
$(call done)
~/.config/kitty/laserwave.conf: | ~/.config/kitty
$(call run,curl -fsSL $(LASERWAVE_URL)/kitty/laserwave.conf -o $@)
~/.config/bat/themes/laserwave.tmTheme: | ~/.config/bat/themes
$(call run,curl -fsSL $(LASERWAVE_URL)/laserwave.tmTheme -o $@)
~/.config/git/laserwave.gitconfig:
$(call run,curl -fsSL $(LASERWAVE_URL)/delta/laserwave.gitconfig -o $@)
~/.config/yazi/flavors/laserwave.yazi/flavor.toml: | ~/.config/yazi/flavors
$(call run,mkdir -p ~/.config/yazi/flavors/laserwave.yazi)
$(call run,curl -fsSL $(LASERWAVE_URL)/yazi/laserwave.yazi/flavor.toml -o $@)
$(call run,curl -fsSL $(LASERWAVE_URL)/yazi/laserwave.yazi/tmtheme.xml -o ~/.config/yazi/flavors/laserwave.yazi/tmtheme.xml)
~/.config/ghostty/themes/laserwave: | ~/.config/ghostty/themes
$(call run,curl -fsSL $(LASERWAVE_URL)/ghostty/laserwave -o $@)
### homebrew
BREW := $(shell command -v brew 2> /dev/null)
.PHONY: brew
brew:
ifndef BREW
$(call err,"brew not found!")
$(call log,"Installing brew...")
$(call run,curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | /bin/bash /dev/stdin)
$(call done)
endif
.PHONY: update-brew
update-brew: brew
$(call log,"Updating brew bundle...")
$(call run,brew bundle)
$(call log,"Cleaning up...")
$(call run,brew cleanup)
$(call done)
### fish
FISH := $(shell command -v fish 2> /dev/null)
.PHONY: fish
fish: brew
ifndef FISH
$(call err,"fish not found!")
$(call log,"Installing fish...")
$(call run,brew install fish fisher)
$(call done)
endif
.PHONY: update-fish
update-fish: fish
$(call log,"Updating fish...")
$(call run,brew upgrade fish fisher)
$(call log,"Updating fisher plugins...")
$(call run,fisher update)
$(call done)
.PHONY: set-fish-as-default
set-fish-as-default: fish
$(call log,"Setting fish as default shell...")
$(call run,echo $(HOMEBREW_PREFIX)/bin/fish | sudo tee -a /etc/shells)
$(call run,chsh -s $(HOMEBREW_PREFIX)/bin/fish)
$(call done)
### bat
BAT := $(shell command -v bat 2> /dev/null)
.PHONY: bat
bat: brew
ifndef BAT
$(call err,"bat not found!")
$(call log,"Installing bat...")
$(call run,brew install bat)
$(call done)
endif
.PHONY: update-bat
update-bat: bat ~/.config/bat/themes/laserwave.tmTheme
$(call log,"Updating bat...")
$(call run,bat cache --build)
$(call done)
### neovim
NVIM := $(shell command -v nvim 2> /dev/null)
~/.local/share/neovim:
$(call err,"neovim source not found!")
$(call log,"Cloning neovim...")
$(call run,git clone [email protected]:neovim/neovim.git $@)
$(call done)
# nvim currently requires [email protected]
# brew doesn't support versioned installs, so a workaround
# is to download the formula for the older version
# and install it locally.
# When the required version changes, we need to:
# 1. update the version number in the target
# 2. update the version number in the cmake phony target
# 3. find the hash corresponding to when the forumla for that version was published
# 4. update the curl URL below with that hash
~/.cache/cmake3.3.0.rb:
$(call run,curl https://raw.githubusercontent.com/Homebrew/homebrew-core/b46f3ad7db7ff9446d44a4c8eef7ad4f59e83018/Formula/c/cmake.rb -o $@)
.PHONY: cmake
cmake: ~/.cache/cmake3.3.0.rb brew
$(call log,"Updating cmake...")
$(call run,ln -sf $< ~/.cache/cmake.rb)
$(call run,brew install -s ~/.cache/cmake.rb)
$(call done)
.PHONY: nvim
nvim: ~/.local/share/neovim
ifndef NVIM
$(call log,"Installing neovim...")
$(call run,cd $< && make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_INSTALL_PREFIX="$$HOME/.local" install)
$(call done)
endif
.PHONY: update-nvim
update-nvim: ~/.local/share/neovim
$(call log,"Updating neovim...")
$(call run,cd $< && git fetch --tags --force && git reset --hard tags/nightly)
$(call run,cd $< && make clean && make distclean && make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_INSTALL_PREFIX="$$HOME/.local" install)
$(call done)
.PHONY update-nvim-plugins:
update-nvim-plugins: nvim
$(call log,"Updating Plugins...")
$(call run,nvim --headless "+Lazy! install" "+silent w! /dev/stdout" +qa)
$(call log,"Updating Parsers...")
$(call run,nvim --headless "+lua require('nvim-treesitter').update():wait(300000)" "+silent w! /dev/stdout" +qa)
$(call done)
### luarocks
LUAROCKS := $(shell command -v luarocks 2> /dev/null)
.PHONY: luarocks
luarocks: brew
ifndef LUAROCKS
$(call log,"Installing luarocks...")
$(call run,brew install luarocks)
$(call log,"Configuring luarocks to use lua_version 5.1...")
$(call run,luarocks config lua_version 5.1)
$(call done)
else
$(call log,"Configuring luarocks to use lua_version 5.1...")
$(call run,luarocks config lua_version 5.1)
$(call done)
endif
### luajit
LUAJIT := $(shell command -v luajit 2> /dev/null)
.PHONY: luajit
luajit: brew
ifndef LUAJIT
$(call log,"Installing luajit...")
$(call run,brew install luajit)
$(call log,"Configuring luarocks to include luajit...")
$(call run,luarocks config variables.LUA_INCDIR /usr/local/include/luajit-2.1)
$(call done)
else
$(call log,"Configuring luarocks to include luajit...")
$(call run,luarocks config variables.LUA_INCDIR /usr/local/include/luajit-2.1)
$(call done)
endif
### nlua
NLUA := $(shell command -v nlua 2> /dev/null)
.PHONY: nlua
nlua: nvim luarocks luajit
ifndef NLUA
$(call log,"Installing nlua...")
$(call run,luarocks --local install nlua)
$(call log,"Configuring luarocks to use nlua...")
$(call run,luarocks config variables.LUA "$$HOME/.luarocks/bin/nlua")
$(call done)
else
$(call log,"Configuring luarocks to use nlua...")
$(call run,luarocks config variables.LUA "$$HOME/.luarocks/bin/nlua")
$(call done)
endif
### busted
BUSTED := $(shell command -v busted 2> /dev/null)
.PHONY: busted
busted: nlua
ifndef BUSTED
$(call log,"Installing busted...")
$(call run,luarocks --local install busted)
$(call done)
endif
### kitty
KITTY := $(shell command -v kitty 2> /dev/null)
.PHONY: kitty
kitty: ~/.config/kitty/laserwave.conf
ifndef KITTY
$(call err,"kitty not found!")
$(call log,"Installing kitty...")
else
$(call log,"Updating kitty...")
endif
$(call run,curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin installer=nightly launch=n)
ifdef MACOS
$(call run,ln -sf /Applications/kitty.app/Contents/MacOS/kitty "$$HOME/.local/bin/kitty")
$(call run,rm /var/folders/*/*/*/com.apple.dock.iconcache; killall Dock) #force refresh of dock icons.
endif
$(call done)
.PHONY: update-kitty
update-kitty: kitty
.PHONY: update-dock-icons
update-dock-icons:
ifdef MACOS
$(call run,rm /var/folders/*/*/*/com.apple.dock.iconcache; killall Dock) #force refresh of dock icons.
$(call done)
else
$(call err,"Not on macOS!")
endif
### qmk
~/Library/Application\ Support/qmk/qmk.ini:
ifdef MACOS
$(call err,"qmk config not found!")
$(call log,"Linking qmk config...")
$(call run,mkdir -p ~/Library/Application\ Support/qmk/)
$(call run,ln -sf "$$HOME/.config/qmk/qmk.ini" "$@")
$(call done)
endif
~/.local/share/qmk_firmware: ~/Library/Application\ Support/qmk/qmk.ini
$(call err,"qmk_firmware not found!")
$(call log,"Cloning qmk_firmware...")
$(call run,qmk setup lettertwo/qmk_firmware --branch lettertwo)
$(call done)
.PHONY: qmk
qmk: ~/Library/Application\ Support/qmk/qmk.ini ~/.local/share/qmk_firmware
.PHONY: update-qmk
update-qmk: qmk
$(call log,"Updating qmk_firmware...")
$(call run,qmk setup lettertwo/qmk_firmware)
$(call done)
### rust
RUSTC := $(shell command -v rustc 2> /dev/null)
~/.cargo/bin/rustup:
$(call err,"rustup not found!")
$(call log,"Installing rustup...")
$(call run,curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh)
$(call done)
~/.cargo/bin/cargo-binstall:
$(call err,"cargo-binstall not found!")
$(call log,"Installing cargo-binstall...")
$(call run,curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | sh)
$(call done)
~/.cargo/bin/cargo-nextest:
$(call err,"cargo-nextest not found!")
$(call log,"Installing cargo-nextest...")
$(call run,cargo binstall cargo-nextest --secure --no-confirm)
$(call done)
~/.cargo/bin/cargo-watch:
$(call err,"cargo-watch not found!")
$(call log,"Installing cargo-watch...")
$(call run,cargo binstall cargo-watch --secure --no-confirm)
$(call done)
.PHONY: rust
rust: ~/.cargo/bin/rustup ~/.cargo/bin/cargo-binstall ~/.cargo/bin/cargo-nextest ~/.cargo/bin/cargo-watch
ifndef RUSTC
$(call err,"rustc not found!")
$(call log,"Installing rust stable...")
$(call run,rustup toolchain install stable)
$(call log,"Setting default toolchain to stable...")
$(call run,rustup default stable)
$(call log,"Installing rust nightly...")
$(call run,rustup toolchain install nightly)
$(call done)
endif
### claude
CLAUDE := $(shell command -v claude 2> /dev/null)
~/.claude/settings.json: ~/.claude
$(call err,"claude settings not found!")
$(call log,"Linking claude settings...")
$(call run,ln -sf "$$HOME/.config/claude/settings.json" "$@")
$(call done)
~/.claude/CLAUDE.md: ~/.claude
$(call err,"claude CLAUDE.md not found!")
$(call log,"Linking claude CLAUDE.md...")
$(call run,ln -sf "$$HOME/.config/claude/CLAUDE.md" "$@")
$(call done)
~/.claude/statusline-command.sh: ~/.claude
$(call err,"claude statusline-command.sh not found!")
$(call log,"Linking claude statusline-command.sh...")
$(call run,ln -sf "$$HOME/.config/claude/statusline-command.sh" "$@")
$(call done)
~/.claude/notify.sh: ~/.claude
$(call err,"claude notify.sh not found!")
$(call log,"Linking claude notify.sh...")
$(call run,ln -sf "$$HOME/.config/claude/notify.sh" "$@")
$(call done)
~/.claude/commands: ~/.claude
$(call log,"Linking claude commands...")
$(call run,ln -sf "$$HOME/.config/claude/commands" "$@")
$(call done)
.PHONY: claude
claude: ~/.claude ~/.claude/settings.json ~/.claude/CLAUDE.md ~/.claude/statusline-command.sh ~/.claude/notify.sh ~/.claude/commands
ifndef CLAUDE
$(call err,"claude not found!")
$(call log,"Installing claude...")
$(call run,curl -fsSL https://claude.ai/install.sh | /bin/bash /dev/stdin)
$(call done)
endif
.PHONY: update-claude
update-claude: claude
$(call log,"Updating claude...")
$(call run,claude update)
$(call done)
### config
.PHONY: update-config
update-config:
$(call log,"Updating config...")
$(call run,git pull)
$(call done)
.PHONY: mkdirs
mkdirs: ~/.local/bin ~/.local/share
.PHONY: install
install: mkdirs laserwave brew set-fish-as-default
@echo ""
$(call done)
@echo ""
@echo "Restart your shell and run $(BLUE)make update$(END) to fetch the latest stuff."
ifdef MACOS
@echo ""
@echo "Other useful things to install:"
@echo " 1password: $(CYAN)https://1password.com/downloads/mac/$(END)"
@echo " raycast: $(CYAN)https://www.raycast.com/$(END)"
@echo " rectangle: $(CYAN)https://rectangleapp.com/pro$(END)"
@echo " MonoLisa: $(CYAN)https://www.monolisa.dev/orders$(END)"
@echo " NerdFonts (Symbols Only): $(CYAN)https://github.com/ryanoasis/nerd-fonts/releases/$(END)"
endif
.PHONY: update
update: update-config \
update-laserwave \
update-brew \
update-fish \
update-bat \
update-nvim \
update-kitty