-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
82 lines (60 loc) · 2.11 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
DOT_DIRS = aws gnupg ssh ssh/control
DOT_DIR_TARGETS = $(DOT_DIRS:%=$(HOME)/.%)
DOT_FILES = zshenv zshrc aws/config \
ssh/config ssh/known_hosts ssh/authorized_keys \
gnupg/gpg.conf gnupg/gpg-agent.conf
DOT_FILE_TARGETS = $(DOT_FILES:%=$(HOME)/.%)
XDG_CONFIG_HOME := $(HOME)/.config
XDG_CONFIG_DIRS := $(shell find config -type d -mindepth 1 | sed -e 's,^config/,,')
XDG_CONFIG_DIR_TARGETS := $(XDG_CONFIG_HOME) $(XDG_CONFIG_DIRS:%=$(XDG_CONFIG_HOME)/%)
XDG_CONFIG_FILES := $(shell find config -type f -mindepth 1 | sed -e 's,^config/,,')
XDG_CONFIG_FILE_TARGETS := $(XDG_CONFIG_FILES:%=$(XDG_CONFIG_HOME)/%)
ZSH_DOT_FILES = zshenv zshrc
ZSH_TARGET_DOT_FILES = $(ZSH_DOT_FILES:%=$(HOME)/.%)
ZSH_COMPILED_TARGETS = $(ZSH_TARGET_DOT_FILES:%=%.zwc)
default: install
install: install_xdg_config install_dotfiles install_vim_config compile_zsh_dotfiles
update: update_dotfiles update_macos update_atom update_vim update_bundler \
update_gems update_npm update_homebrew
install_xdg_config: $(XDG_CONFIG_DIR_TARGETS) $(XDG_CONFIG_FILE_TARGETS)
.PHONY: install_xdg_config
install_dotfiles: $(DOT_DIR_TARGETS) $(DOT_FILE_TARGETS)
.PHONY: install_dotfiles
install_vim_config: $(HOME)/.vim $(HOME)/.vimrc
.PHONY: install_vim_config
$(HOME)/.vim:
git clone --recursive [email protected]:mathie/.vim.git $@
$(HOME)/.vimrc: $(HOME)/.vim/vimrc
ln -snf "$<" "$@"
$(XDG_CONFIG_DIR_TARGETS) $(DOT_DIR_TARGETS):
install -d -m 0700 $(XDG_CONFIG_DIR_TARGETS) $(DOT_DIR_TARGETS)
$(XDG_CONFIG_HOME)/%: config/%
ln -snf "$(PWD)/$<" "$@"
$(HOME)/.%: %
ln -snf "$(PWD)/$<" "$@"
compile_zsh_dotfiles: $(ZSH_COMPILED_TARGETS)
$(HOME)/.%.zwc: $(HOME)/.%
zsh -c 'zcompile "$<"'
update_dotfiles:
git pull && \
$(MAKE) install
update_macos:
softwareupdate --install --all
update_atom:
[ -x $$(which apm) ] && apm upgrade --no-confirm
update_vim: $(HOME)/.vim
cd "$<" && \
git pull && \
git submodule update --init --recursive && \
rake
update_homebrew:
brew update
brew bundle
brew upgrade
brew cleanup
update_bundler:
bundle update
update_gems:
[ -x $$(which gem) ] && gem update || true
update_npm:
[ -x $$(which npm) ] && npm -g update || true