-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
46 lines (38 loc) · 1.35 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
symlink_to_home = \
if test -e ~/$(file); then \
echo "Warning: ~/$(file) already exists"; \
else \
ln -s ~/dotfiles/$(file) ~/$(file); \
fi;
symlink_to_config = \
if test -e ~/.config/$(file); then \
echo "Warning: ~/.config/$(file) already exists"; \
else \
ln -s ~/dotfiles/$(file) ~/.config/$(file); \
fi;
remove_home_symlink = \
if test -e ~/$(file); then \
if test -h ~/$(file); then \
rm ~/$(file); \
else \
echo "Warning: ~/$(file) is not a symlink"; \
fi; \
fi;
remove_config_symlink = \
if test -e ~/.config/$(file); then \
if test -h ~/.config/$(file); then \
rm ~/.config/$(file); \
else \
echo "Warning: ~/.config/$(file) is not a symlink"; \
fi; \
fi;
home_candidates = .gitconfig bin .perlcriticrc .irbrc \
.zshrc .wezterm.lua
config_candidates = fish nvim
all:
@$(foreach file,$(home_candidates),$(symlink_to_home))
@$(foreach file,$(config_candidates),$(symlink_to_config))
clean:
@$(foreach file,$(home_candidates),$(remove_home_symlink))
@$(foreach file,$(config_candidates),$(remove_config_symlink))
.PHONY: clean all