From: Samir Benmendil Date: Sat, 27 Oct 2012 05:21:59 +0000 (+0200) Subject: ignore links in MAkefile X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/4b06eb26103a8f0840915532fdf411ef82e9ad24 ignore links in MAkefile --- diff --git a/Makefile b/Makefile index 48a4ccb..1c5af2e 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,30 @@ APATH := $(realpath .) RPATH := $(subst $(wildcard ~/),,$(APATH)) -FILES := +FILES := bin DOTFILES := bash* flexget vim* .PHONY: install $(FILES) $(DOTFILES) install: $(FILES) $(DOTFILES) $(FILES): - @if [[ -f ~/$@ || -d ~/$@ ]]; then \ - if [[ -d $@ ]]; then \ - cp -r ~/$@/* $@; \ - else \ - cp -r ~/$@ $@; \ - fi; \ - rm -r ~/$@; \ + @if [[ -e ~/$@ && ! -L ~/$@ ]]; then \ + if [[ -d $@ ]]; then \ + cp -r ~/$@/* $@; \ + else \ + cp -r ~/$@ $@; \ + fi; \ + rm -r ~/$@; \ fi; - ln -sf $(RPATH)/$@ ~/.$@ + ln -sf $(RPATH)/$@ ~/$@ $(DOTFILES): - @if [[ -f ~/.$@ || -d ~/.$@ ]]; then \ - if [[ -d $@ ]]; then \ - cp -r ~/.$@/* $@; \ - else \ - cp -r ~/.$@ $@; \ - fi; \ - rm -r ~/.$@; \ + @if [[ -e ~/.$@ && ! -L ~/.$@ ]]; then \ + if [[ -d .$@ ]]; then \ + cp -r ~/.$@/* $@; \ + else \ + cp -r ~/.$@ $@; \ + fi; \ + rm -r ~/.$@; \ fi; - ln -sf $(RPATH)/$@ ~/.$@ + ln -sf $(RPATH)/$@ ~/.$@