-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
77 lines (60 loc) · 1.94 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
HOSTNAME := $(shell hostname -s)
LN_FLAGS := -sfn
BREW := $(shell command -v brew 2> /dev/null)
symlinks := gitattributes \
gitconfig \
gitignore \
lftprc \
mbsyncrc \
sqliterc \
tmux.conf \
zshenv \
zshrc
zsh_extensions := zsh-syntax-highlighting
.PHONY: $(symlinks) $(zsh_extensions) ghostty iterm2.conf
COLOR := \033[32;01m
NO_COLOR := \033[0m
all: install
help:
@echo "Makefile for installing dotfiles"
@echo
@echo "Create symlinks:"
@echo " $(COLOR)make install$(NO_COLOR)"
@echo
@echo "Install zsh extras:"
@echo " $(COLOR)make zsh-extras$(NO_COLOR)"
@echo
@echo "Maintenance:"
@echo " $(COLOR)make print-dead$(NO_COLOR) Print dead symlinks"
@echo " $(COLOR)make clean-dead$(NO_COLOR) Delete dead symlinks"
@echo " $(COLOR)make update$(NO_COLOR) Alias for git pull"
# Shell environment
ghostty:
mkdir -p ~/.config/ghostty
test -e $(CURDIR)/$@ && ln $(LN_FLAGS) $(CURDIR)/$@ ~/.config/ghostty/config
iterm2.conf: ITERM2_PLIST=~/.config/iterm2/com.googlecode.iterm2.plist
iterm2.conf:
mkdir -p ~/.config/iterm2
# Copy the changes into this repository if the config already exists as a
# regular file. When changing iTerm2 config, save it in General -> Preferences
# manually. This will replace the symlink with a regular file, so this target
# should be run again.
test -f $(ITERM2_PLIST) -a ! -L $(ITERM2_PLIST) && cp -a $(ITERM2_PLIST) $(CURDIR)/iterm2.conf || true
test -e $(CURDIR)/$@ && ln $(LN_FLAGS) $(CURDIR)/$@ $(ITERM2_PLIST)
install: $(symlinks) iterm2.conf
$(symlinks):
test -e $(CURDIR)/$@ && ln $(LN_FLAGS) $(CURDIR)/$@ ~/.$@
zsh-extras: $(zsh_extensions)
$(zsh_extensions):
ifneq ($(BREW),)
brew install $@
else
$(error could not find a package manager to install $@)
endif
# Maintenance
print-dead:
find ~ -maxdepth 1 -name '.*' -type l -exec test ! -e {} \; -print
clean-dead:
find ~ -maxdepth 1 -name '.*' -type l -exec test ! -e {} \; -delete
update:
git pull --rebase --quiet