-.PHONY: install
+APATH := $(realpath .)
-install:
- cp -f vimrc ~/.vimrc
- cp -f flexget/config.yml ~/.flexget/config.yml
+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 ~/.vimrc vimrc
- cp -f ~/.flexget/config.yml flexget/config.yml
+.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/$@