dotfiles/Makefile

49 lines
1.4 KiB
Makefile

LN_FLAGS = -sfnv
MKDIR_FLAGS = -pv
home_symlinks = Xresources xbindkeysrc xinitrc vimrc vim tmux.conf gitconfig bashrc
# apparmor doesn't work with symlinks (redshift)
config_copy = redshift
config_symlinks = i3 alacritty
gnupg_symlinks = gpg-agent.conf
local_install: Xresources xbindkeysrc xinitrc vimrc vim i3 gitconfig gpg-agent.conf bashrc alacritty redshift
mac_local_install: vimrc vim gpg-agent.conf tmux.conf bashrc
remote_install: vim vimrc tmux.conf
.PHONY: $(home_symlinks)
$(home_symlinks):
$(eval DESTDIR := $(shell dirname ~/.$@))
mkdir $(MKDIR_FLAGS) $(DESTDIR)
test -e $(CURDIR)/$@ && ln $(LN_FLAGS) $(CURDIR)/$@ ~/.$@
.PHONY: $(config_copy)
$(config_copy):
$(eval DESTDIR := $(shell dirname ~/.config/$@))
mkdir $(MKDIR_FLAGS) $(DESTDIR)
test -e $(CURDIR)/$@ && cp -r --remove-destination -p $(CURDIR)/$@ ~/.config/$@
.PHONY: $(config_symlinks)
$(config_symlinks):
$(eval DESTDIR := $(shell dirname ~/.config/$@))
mkdir $(MKDIR_FLAGS) $(DESTDIR)
test -e $(CURDIR)/$@ && ln $(LN_FLAGS) $(CURDIR)/$@ ~/.config/$@
.PHONY: $(ssh_symlinks)
$(ssh_symlinks):
$(eval DESTDIR := $(shell dirname ~/.ssh/$@))
mkdir $(MKDIR_FLAGS) $(DESTDIR)
test -e $(CURDIR)/$@ && ln $(LN_FLAGS) $(CURDIR)/$@ ~/.ssh/$@
.PHONY: $(gnupg_symlinks)
$(gnupg_symlinks):
$(eval DESTDIR := $(shell dirname ~/.gnupg/$@))
mkdir $(MKDIR_FLAGS) $(DESTDIR)
test -e $(CURDIR)/$@ && ln $(LN_FLAGS) $(CURDIR)/$@ ~/.gnupg/$@