-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
120 lines (89 loc) · 2.13 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
116
117
118
119
120
symlinks = \
bat \
config \
delta \
exa \
gitconfig \
gitignore \
irbrc \
local \
ruby-version \
vimrc \
formulae = \
bat \
cmake \
exa \
fish \
fzf \
git \
git-delta \
git-lfs \
hub \
jq \
libyaml \
neovim \
ngrok \
ninja \
postgresql@15 \
rbenv \
ripgrep \
ruby-build \
rust \
trash \
tree \
wifi-password \
# stripe/stripe-cli/stripe \
cask_formulae = \
ngrok \
default: | update clean
install: | brew ln ruby vim
update: | install
brew update && brew upgrade || true
gem update || true
vim +PlugUpgrade +PlugInstall +PlugUpdate +quitall || true
clean: | install
brew cleanup
gem clean
vim +PlugClean +quitall
# brew
homebrew_root = /opt/homebrew
cellar := $(homebrew_root)/Cellar
taps := $(homebrew_root)/Homebrew/Taps
prefixed_formulae := $(addprefix $(cellar)/,$(notdir $(formulae)))
brew: | $(brew_cask) $(prefixed_formulae)
homebrew := $(homebrew_root)/bin/brew
$(homebrew):
/bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$(prefixed_formulae): | $(homebrew)
brew install $(notdir $@)
java := $(caskroom)/java
$(java): | $(brew_cask)
brew cask install java
# ln
prefixed_symlinks := $(addprefix $(HOME)/.,$(symlinks))
ln: | $(prefixed_symlinks)
$(prefixed_symlinks):
@ln -Fsv $(PWD)/$(patsubst .%,%,$(notdir $@)) $@
# ruby
ruby_version := $(shell cat $(PWD)/ruby-version)
ruby := $(HOME)/.rbenv/versions/$(ruby_version)
bundler := $(ruby)/bin/bundle
ruby: | $(ruby) $(bundler)
$(ruby): | $(HOME)/.ruby-version $(cellar)/rbenv $(cellar)/ruby-build
rbenv install $(ruby_version)
gem := $(ruby)/bin/gem
$(bundler): | $(ruby)
$(gem) install bundler
# vim
vim: | vim_tmp vim_plug
vim_tmp := $(HOME)/.vim/tmp
vim_tmp: | $(vim_tmp)
$(vim_tmp):
mkdir -p $(vim_tmp)
vim_plug := $(HOME)/.vim/autoload/plug.vim
vim_plug: | $(vim_plug)
$(vim_plug):
curl -fLo $(vim_plug) --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# make
.PHONY: update clean