-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (42 loc) · 1.74 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
export XDG_DATA_HOME = $(HOME)/.local/share
OS := $(shell if [[ "$$(uname -s)" == "Darwin" ]]; then echo macos; fi)
export HOMEBREW_PREFIX := $(shell if [[ "$$(uname -m)" == "arm64" ]]; then echo /opt/homebrew; else echo /usr/local; fi)/bin
export PATH := $(HOMEBREW_PREFIX):$(HOME)/.local/bin:$(PATH)
BASE_BREW = $(HOME)/dotfiles/.excluded/base
BASE_CASKS = $(HOME)/dotfiles/.excluded/base_casks
BASE_MAS = $(HOME)/dotfiles/.excluded/base_mas
.PHONY: stow brew
# Installing
install: $(OS)
uninstall: un$(OS)
## MacOS specific
macos: base brew stow settings finish
unmacos: unstow unbrew cleanup finish
addshell:
echo $(HOMEBREW_PREFIX)/fish | sudo tee -a /etc/shells
chsh -s $(HOMEBREW_PREFIX)/fish
brew:
/bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-$(HOMEBREW_PREFIX)/brew tap homebrew/cask-fonts
-export HOMEBREW_CASK_OPTS="--no-quarantine"; cat $(BASE_BREW) | xargs $(HOMEBREW_PREFIX)/brew install
-export HOMEBREW_CASK_OPTS="--no-quarantine"; cat $(BASE_CASKS) | xargs $(HOMEBREW_PREFIX)/brew install --cask
cat $(BASE_MAS) | grep -o '^[0-9]*' | xargs $(HOMEBREW_PREFIX)/mas install
unbrew:
# mas does not uninstall, so this step has to be done manually.
-$(HOMEBREW_PREFIX)/brew remove --force --ignore-dependencies $(shell $(HOMEBREW_PREFIX)/brew list)
/bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
sudo rm -rf $(HOMEBREW_PREFIX)
stow:
$(HOMEBREW_PREFIX)/stow -R */
unstow:
$(HOMEBREW_PREFIX)/stow -D */
settings:
/bin/zsh .excluded/.macos
cleanup:
rm -rf $(HOME)/.cache
rm -rf $(HOME)/.config
rm -rf $(HOME)/.local
finish:
sudo killall Finder Dock
rm -rf $(HOME)/.viminfo $(HOME)/.zsh_history $(HOME)/.zsh_sessions
-killall Terminal