X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/74ebbf77e192cf318f8b98f747233395f01f245c..092285f8f9c2a0514ac60bc944af8aa79da1894e:/Makefile diff --git a/Makefile b/Makefile index 8f85fd5..64e9b73 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,30 @@ -.PHONY: install +APATH := $(realpath .) +RPATH := $(subst $(wildcard ~/),,$(APATH)) -install: - cp -f vimrc ~/.vimrc - cp -f flexget/config.yml ~/.flexget/config.yml +FILES := bin +DOTFILES := bash* flexget vim* -update: - cp -f ~/.vimrc vimrc - cp -f ~/.flexget/config.yml flexget/config.yml +.PHONY: install $(FILES) $(DOTFILES) +install: $(FILES) $(DOTFILES) + +$(FILES): + @if [[ -e ~/$@ && ! -L ~/$@ ]]; then \ + if [[ -d $@ ]]; then \ + cp -r ~/$@/* $@; \ + else \ + cp -r ~/$@ $@; \ + fi; \ + rm -r ~/$@; \ + fi; + ln -sfT $(RPATH)/$@ ~/$@ + +$(DOTFILES): + @if [[ -e ~/.$@ && ! -L ~/.$@ ]]; then \ + if [[ -d .$@ ]]; then \ + cp -r ~/.$@/* $@; \ + else \ + cp -r ~/.$@ $@; \ + fi; \ + rm -r ~/.$@; \ + fi; + ln -sfT $(RPATH)/$@ ~/.$@