X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/352fe1c31a12484e932c323b44f05070c6076705..2983793fb38ae06dface67c895bf85ff37a7a05c:/Makefile diff --git a/Makefile b/Makefile index af701e0..790826f 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,41 @@ -.PHONY: install update +APATH := $(realpath .) -install: - cp -f bashrc ~/.bashrc - cp -f bash_aliases ~/.bash_aliases - cp -f bash_colors ~/.bash_colors - cp -f bash_logout ~/.bash_logout - cp -f flexget/config.yml ~/.flexget/config.yml - cp -f vimrc ~/.vimrc +FILES := bin +DOTFILES := aliases bash* conky* flexget git* goobookrc msmtp* mutt ncmpcpp offlineimap* vim* weechat xbindkeysrc Xmodmap Xresources xprofile zsh* +CONFIGFILES := retroarch compton.conf mimeo.conf -update: - cp -f ~/.bashrc bashrc - cp -f ~/.bash_aliases bash_aliases - cp -f ~/.bash_colors bash_colors - cp -f ~/.bash_logout bash_logout - cp -f ~/.flexget/config.yml flexget/config.yml - cp -f ~/.vimrc vimrc +.PHONY: install $(FILES) $(DOTFILES) $(CONFIGFILES) +install: $(FILES) $(DOTFILES) $(CONFIGFILES) + +$(FILES): + @if [[ -e ~/$@ && ! -L ~/$@ ]]; then \ + if [[ -d $@ ]]; then \ + cp -r ~/$@/* $@; \ + else \ + cp -r ~/$@ $@; \ + fi; \ + rm -r ~/$@; \ + fi; + ln -sfT $(APATH)/$@ ~/$@ + +$(DOTFILES): + @if [[ -e ~/.$@ && ! -L ~/.$@ ]]; then \ + if [[ -d .$@ ]]; then \ + cp -r ~/.$@/* $@; \ + else \ + cp -r ~/.$@ $@; \ + fi; \ + rm -r ~/.$@; \ + fi; + ln -sfT $(APATH)/$@ ~/.$@ + +$(CONFIGFILES): + @if [[ -e ~/.config/$@ && ! -L ~/.config/$@ ]]; then \ + if [[ -d .config/$@ ]]; then \ + cp -r ~/.config/$@/* $@; \ + else \ + cp -r ~/.config/$@ $@; \ + fi; \ + rm -r ~/.config/$@; \ + fi; + ln -sfT $(APATH)/$@ ~/.config/$@