-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
138 lines (109 loc) · 3.91 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
.DEFAULT_GOAL := all
# Configuration Variables -------------------------------------------------- {{{
# Gloabl Binaries
global_node_modules := \
bash-language-server \
dockerfile-language-server-nodejs \
neovim \
speed-test \
typescript \
typescript-language-server
global_gems := \
neovim
# Paths to folders & binaries
# Brew
homebrew_root := brew --prefix
cellar := $(homebrew_root)/Cellar
bin := $(homebrew_root)/bin
homebrew := $(bin)/brew
# asdf
# All `asdf_plugins` should all have a coresponding entry in ~/.tool-versions.
asdf_plugins := nodejs ruby rust sbcl sbt scala golang python
asdf_root := $(HOME)/.asdf
asdf_shims := $(asdf_root)/shims
# Node
npm := $(asdf_shims)/npm
node_modules_root := $(asdf_shims)
prefixed_node_modules := $(addprefix $(node_modules_root)/,$(global_node_modules))
# Ruby
gem := $(asdf_shims)/gem
gems_root := $(asdf_shims)
prefixed_gems := $(addprefix $(gems_root)/,$(global_gems))
# }}}
# Core Targets ------------------------------------------------------------- {{{
.PHONY: all
all: | update clean ## Run everything. Default target.
.PHONY: update
update: | install ## Update everything.
rcup -v
brew bundle --global
gem update $(global_gems)
npm update -g
vim +PlugUpdate +quitall
# nvim +PackerSync +quitall # TODO: Get this working.
.PHONY: install
install: | brew asdf node_modules gems ## Install everything. (Does not update anything.)
vim +PlugInstall +quitall
# nvim +PackerInstall +quitall # TODO: Get this working.
.PHONY: clean
clean: ## Remove all unnecessary files our package managers don't need.
brew bundle --global cleanup --force
brew cleanup
gem clean
vim +PlugClean +quitall
# nvim +PackerClean +quitall # TODO: Get this working.
# }}}
# Homebrew ----------------------------------------------------------------- {{{
brew_status := $(shell brew bundle check --no-upgrade > /dev/null && echo 0 || echo 1)
$(homebrew):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
.PHONY: brew
breww: | $(homebrew) ## Install Homebrew & Brewfile's formulae, casks, & apps.
ifeq ($(brew_status), 1)
brew bundle --no-upgrade
endif
# }}}
# asdf --------------------------------------------------------------------- {{{
$(asdf_plugins):
-asdf plugin-add $@
.PHONY: asdf
asdf: | $(asdf_plugins) ## Install specific verions of languages -- language versions specified in ~/.tool-versions.
asdf install
# }}}
# Node --------------------------------------------------------------------- {{{
# If we don't prefix the $prefixed_node_modules we get a warning from Make as
# the targets end up being the same because we install a package called "neovim"
# from both npm and gem.
node_modules_$(prefixed_node_modules):
$(npm) install -g $(notdir $@)
.PHONY: node_modules
node_modules: | node_modules_$(prefixed_node_modules) ## Install global node modules.
# }}}
# Ruby --------------------------------------------------------------------- {{{
# If we don't prefix the $prefixed_gems we get a warning from Make as
# the targets end up being the same because we install a package called "neovim"
# from both npm and gem.
gems_$(prefixed_gems):
$(gem) install $(notdir $@)
.PHONY: gems
gems: | gems_$(prefixed_gems) ## Install global gems.
# }}}
# Shellcheck --------------------------------------------------------------- {{{
.PHONY: shellcheck
shellcheck: ## Runs the shellcheck tests on the scripts.
docker run --rm -i -t \
--name df-shellcheck \
-v $(CURDIR):/usr/src:ro \
--workdir /usr/src \
r.j3ss.co/shellcheck ./tag-scripts/config/scripts/test.sh
# }}}
# Help --------------------------------------------------------------------- {{{
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help: ## Print this help text.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
sort | \
awk 'BEGIN {FS = ":.*?## "}; \
{printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# }}}
# vim: foldmethod=marker:foldmarker={{{,}}}