-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
176 lines (132 loc) · 3.74 KB
/
Makefile
File metadata and controls
176 lines (132 loc) · 3.74 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
# ----------------------------
# Config
# ----------------------------
DRYRUN ?= 0
ifeq ($(DRYRUN),1)
RUN := echo
else
RUN :=
endif
BIN_DIR := ~/.local/bin
SRC_DIR := src
STATUS_DIR := statusbar
SYSTEMD_DIR := systemd
SYSTEMD_OUTDIR := ~/.config/systemd/user
PACMAN_HOOKS_SRC := etc/pacman.d/hooks
PACMAN_HOOKS_DST := /etc/pacman.d/hooks
# ----------------------------
# Uninstall arg passthrough
# ----------------------------
ifeq (uninstall,$(firstword $(MAKECMDGOALS)))
ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(ARGS):;@:)
endif
default: install
# ----------------------------
# Script install / uninstall
# ----------------------------
SCRIPT_PAIRS := \
$(SRC_DIR) $(BIN_DIR) \
$(SRC_DIR)/$(STATUS_DIR) $(BIN_DIR)/$(STATUS_DIR)
.PHONY: scripts-install scripts-uninstall
scripts-install:
@set -- $(SCRIPT_PAIRS); \
while [ $$# -gt 0 ]; do \
$(RUN) ./install.sh $$1 $$2; \
shift 2; \
done
scripts-uninstall:
@set -- $(SCRIPT_PAIRS); \
while [ $$# -gt 0 ]; do \
$(RUN) ./uninstall.sh $$1 $$2; \
shift 2; \
done
COMPLETIONS := rgs
.PHONY: $(COMPLETIONS)
$(COMPLETIONS):
$(RUN) ./complete.sh $@
# ----------------------------
# Dotfiles (generic)
# ----------------------------
DOTFILES := \
albert bspwm sxhkd conky colors.sh dunst i3 i3blocks \
i3status-rust i3status kitty mpd nano neofetch newsboat \
nvim ranger rofi sxiv wal xfce4 compton picom zathura \
rc Xresources taskrc qtile k9s
.PHONY: $(DOTFILES)
$(DOTFILES):
$(RUN) ./mklink $@
# ----------------------------
# Dotfiles (special cases)
# ----------------------------
tmux:
$(RUN) ./mklink tmux
$(RUN) ln -sf "${HOME}/.config/tmux/.tmux.conf" "${HOME}/.tmux.conf"
vscode:
$(RUN) mkdir -p "${HOME}/.config/VSCodium/User"
$(RUN) ./mklink "VSCodium/User/settings.json"
$(RUN) ./mklink "VSCodium/User/keybindings.json"
$(RUN) mkdir -p "${HOME}/.config/Code/User"
$(RUN) ./mklink "Code/User/settings.json"
$(RUN) ./mklink "Code/User/keybindings.json"
$(RUN) ./mklink "Code/User/init.vim"
VSCODE_EXTENSIONS := arcticicestudio.nord-visual-studio-code \
github.copilot \
github.copilot-chat \
ms-azuretools.vscode-containers \
ms-vscode-remote.remote-containers \
ms-vscode.makefile-tools \
timonwong.shellcheck \
vscodevim.vim
vscode-ext:
@for ext in $(VSCODE_EXTENSIONS); do \
$(RUN) /usr/bin/code --install-extension $$ext || $(RUN) /usr/bin/codium --install-extension $$ext; \
done
zsh:
$(RUN) ./mklink zsh
$(RUN) mkdir -p "${HOME}/.cache/zsh"
$(RUN) ln -sf "${HOME}/.config/zsh/.zshrc" "${HOME}/.zshrc"
xmodmap:
$(RUN) ln -sf "$(PWD)/.Xmodmap" "${HOME}/.Xmodmap"
ideavim:
$(RUN) ln -sf "$(PWD)/.ideavimrc" "${HOME}/.ideavimrc"
imwheel:
$(RUN) ln -sf "$(PWD)/.imwheelrc" "${HOME}/.imwheelrc"
# ----------------------------
# Source-based dotfiles
# ----------------------------
SOURCES := profile xprofile bashrc
.PHONY: $(SOURCES)
$(SOURCES):
$(RUN) ./mksource .$@
# ----------------------------
# systemd & pacman hooks
# ----------------------------
systemd:
$(RUN) cp $(SYSTEMD_DIR)/* $(SYSTEMD_OUTDIR)/
pacman-hooks:
@for f in $(PACMAN_HOOKS_SRC)/*; do \
$(RUN) sh -c 'envsubst < "$$1" | sudo tee "$(PACMAN_HOOKS_DST)/$$(basename "$$1")"' _ $$f; \
done
# ----------------------------
# Aggregate targets
# ----------------------------
.PHONY: default install dotfiles-install
install: scripts-install dotfiles-install completions-install
completions-install: \
$(COMPLETIONS)
dotfiles-install: \
$(DOTFILES) \
tmux vscode zsh \
$(SOURCES) \
xmodmap ideavim imwheel
add:
echo '#!/usr/bin/env sh' > $(SRC_DIR)/$(s).sh
chmod +x $(SRC_DIR)/$(s).sh
.ONESHELL:
add-comp-zsh:
cat <<EOF > $(SRC_DIR)/zsh-completions/_$(s)
#compdef $(s)
_arguments "1[arg]"
EOF
chmod +x $(SRC_DIR)/zsh-completions/_$(s)