]> git.rmz.io Git - dotfiles.git/blobdiff - Makefile
Other changes at cadscan (with the ones I want to keep stripped)
[dotfiles.git] / Makefile
index af701e095a06f1a683e04e6dd305e715ba3a18a1..5e09a427432adc696de28efa7c49e76ac10f929a 100644 (file)
--- 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 := conky* goobookrc msmtp* mutt profile tmux.conf weechat Xresources xprofile zprofile zshenv zshrc
+CONFIGFILES := aliases compton.conf git gnupg mimeo.conf mpd mpv ncmpcpp offlineimap ranger retroarch systemd vim xbindkeys xkb zsh
 
-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/$@