]> git.rmz.io Git - dotfiles.git/blobdiff - Makefile
Backup UH
[dotfiles.git] / Makefile
index 3184bb619f16f60853b29708be82c716bbfeda38..87fa04d70b7701d70ace94366b65b31f7fd06250 100644 (file)
--- a/Makefile
+++ b/Makefile
 APATH := $(realpath .)
 
+XDG_CONFIG_HOME ?= ~/.config
+XDG_CACHE_HOME  ?= ~/.cache
+XDG_DATA_HOME   ?= ~/.local/share
+
 FILES := bin
 DOTFILES := goobookrc msmtp* profile tmux.conf weechat Xresources
-CONFIGFILES := aliases compton.conf git mpv offlineimap ranger retroarch xbindkeys xkb
+CONFIGFILES := compton.conf mpv offlineimap ranger retroarch xbindkeys xkb
+
+.PHONY: core_files
+core_files: dircolors git ssh systemd vim zsh
 
 .PHONY: install $(FILES) $(DOTFILES) $(CONFIGFILES)
 install: $(FILES) $(DOTFILES) $(CONFIGFILES)
 
-~/.config:
-       mkdir -p ~/.config
+$(XDG_DATA_HOME) $(XDG_CONFIG_HOME):
+       mkdir -p $@
 
-vim:
-       ln -sfT $(APATH)/vim ~/.config/vim
-       mkdir -p ~/.local/share/vim
-       git clone https://github.com/gmarik/vundle ~/.local/share/vim/vundle
-.PHONY: vim
+awesome: $(XDG_CONFIG_HOME)
+       ln -sfT $(APATH)/awesome $(XDG_CONFIG_HOME)/awesome
+.PHONY: awesome
 
-mutt:
-       ln -sfT $(APATH)/mutt ~/.config/mutt
-.PHONY: mutt
+dircolors: $(XDG_CONFIG_HOME)
+       ln -sfT $(APATH)/dircolors $(XDG_CONFIG_HOME)/dircolors
+.PHONY: dircolors
 
 gdb:
+       mkdir $(XDG_DATA_HOME)/gdb
+       ln -sfT $(APATH)/gdb $(XDG_CONFIG_HOME)/gdb
        ln -sfT $(APATH)/gdbinit ~/.gdbinit
        ln -sfT $(APATH)/cgdb ~/.cgdb
 .PHONY: gdb
 
-awesome: ~/.config
-       ln -sfT $(APATH)/awesome ~/.config/awesome
-.PHONY: awesome
+git: $(XDG_CONFIG_HOME)
+       ln -sfT $(APATH)/git $(XDG_CONFIG_HOME)/git
+       ln -sfT $(APATH)/tig $(XDG_CONFIG_HOME)/tig
+.PHONY: git
 
-qutebrowser: ~/.config
-       ln -sfT $(APATH)/qutebrowser ~/.config/qutebrowser
-       mkdir -p ~/downloads
-.PHONY: qutebrowser
+gnupg: systemd
+       ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
+       systemctl --user enable gpg-agent.socket gpg-agent-extra.socket gpg-agent-browser.socket dirmngr.socket
+       systemctl --user start gpg-agent.socket gpg-agent-extra.socket gpg-agent-browser.socket dirmngr.socket
+.PHONY: gnupg
 
 mpd: systemd
-       ln -sfT $(APATH)/mpd ~/.config/mpd
-       mkdir -p ~/.local/share/mpd/playlists
+       ln -sfT $(APATH)/mpd $(XDG_CONFIG_HOME)/mpd
+       mkdir -p $(XDG_DATA_HOME)/mpd/playlists
        systemctl --user enable mpd
        systemctl --user start mpd
 .PHONY: mpd
 
-ncmpcpp:
-       ln -sfT $(APATH)/ncmpcpp ~/.config/ncmpcpp
-       mkdir -p ~/.local/share/mpd/lyrics
+mutt: $(XDG_CONFIG_HOME)
+       ln -sfT $(APATH)/mutt $(XDG_CONFIG_HOME)/mutt
+.PHONY: mutt
+
+ncmpcpp: $(XDG_CONFIG_HOME)
+       ln -sfT $(APATH)/ncmpcpp $(XDG_CONFIG_HOME)/ncmpcpp
+       mkdir -p $(XDG_DATA_HOME)/mpd/lyrics
 .PHONY: ncmpcpp
 
-systemd:
-       ln -sfT $(APATH)/$@ ~/.config/$@
+qutebrowser: $(XDG_CONFIG_HOME)
+       ln -sfT $(APATH)/qutebrowser $(XDG_CONFIG_HOME)/qutebrowser
+       mkdir -p ~/downloads
+.PHONY: qutebrowser
+
+ssh:
+       ln -sfT $(APATH)/ssh/config ~/.ssh/config
+.PHONY: ssh
+
+systemd: $(XDG_CONFIG_HOME)
+       ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
 .PHONY: systemd
 
-gnupg: systemd
-       ln -sfT $(APATH)/$@ ~/.config/$@
-       systemctl --user enable gpg-agent.socket gpg-agent-extra.socket gpg-agent-browser.socket dirmngr.socket
-       systemctl --user start gpg-agent.socket gpg-agent-extra.socket gpg-agent-browser.socket dirmngr.socket
-.PHONY: gnupg
+task: $(XDG_CONFIG_HOME)
+       ln -sfT $(APATH)/taskrc $(XDG_CONFIG_HOME)/taskrc
+.PHONY: task
 
-zsh:
-       ln -sfT $(APATH)/zshrc ~/.zshrc
-       ln -sfT $(APATH)/zprofile ~/.zprofile
-       ln -sfT $(APATH)/zshenv ~/.zshenv
-       ln -sfT $(APATH)/zsh ~/.config/zsh
-       mkdir -p ~/.cache/zsh
-.PHONY: zsh
+urxvt: $(XDG_CONFIG_HOME)
+       ln -sfT $(APATH)/urxvt $(XDG_CONFIG_HOME)/urxvt
+.PHONY: urxvt
+
+vim: $(XDG_CONFIG_HOME)
+       ln -sfT $(APATH)/vim $(XDG_CONFIG_HOME)/vim
+       mkdir -p $(XDG_DATA_HOME)/vim
+       -git clone https://github.com/gmarik/vundle $(XDG_DATA_HOME)/vim/vundle
+.PHONY: vim
+
+yay: $(XDG_CONFIG_HOME)
+       ln -sfT $(APATH)/yay $(XDG_CONFIG_HOME)/yay
+       mkdir -p $(XDG_CACHE_HOME)/yay
 
 xprofile:
        ln -sfT $(APATH)/xprofile ~/.xprofile
 .PHONY: xprofile
 
-dircolors:
-       ln -sfT $(APATH)/dircolors ~/.config/dircolors
-.PHONY: dircolors
-
-urxvt:
-       ln -sfT $(APATH)/urxvt ~/.config/urxvt
-.PHONY: urxvt
+zsh: $(XDG_CONFIG_HOME)
+       ln -sfT $(APATH)/zshrc ~/.zshrc
+       ln -sfT $(APATH)/zprofile ~/.zprofile
+       ln -sfT $(APATH)/zshenv ~/.zshenv
+       ln -sfT $(APATH)/zsh $(XDG_CONFIG_HOME)/zsh
+       ln -sfT $(APATH)/aliases $(XDG_CONFIG_HOME)/aliases
+       mkdir -p $(XDG_CACHE_HOME)/zsh
+       mkdir -p $(XDG_DATA_HOME)/zsh
+.PHONY: zsh
 
-$(FILES): 
+$(FILES):
        @if [[ -e ~/$@ && ! -L ~/$@ ]]; then \
            if [[ -d $@ ]]; then \
              cp -r ~/$@/* $@; \
@@ -84,10 +112,10 @@ $(FILES):
              cp -r ~/$@ $@; \
            fi; \
            rm -r ~/$@; \
-       fi; 
+       fi;
        ln -sfT $(APATH)/$@ ~/$@
 
-$(DOTFILES): 
+$(DOTFILES):
        @if [[ -e ~/.$@ && ! -L ~/.$@ ]]; then \
            if [[ -d .$@ ]]; then \
              cp -r ~/.$@/* $@; \
@@ -95,16 +123,16 @@ $(DOTFILES):
              cp -r ~/.$@ $@; \
            fi; \
            rm -r ~/.$@; \
-       fi; 
+       fi;
        ln -sfT $(APATH)/$@ ~/.$@
 
-$(CONFIGFILES):  ~/.config
-       @if [[ -e ~/.config/$@ && ! -L ~/.config/$@ ]]; then \
+$(CONFIGFILES):  $(XDG_CONFIG_HOME)
+       @if [[ -e $(XDG_CONFIG_HOME)/$@ && ! -L $(XDG_CONFIG_HOME)/$@ ]]; then \
            if [[ -d .config/$@ ]]; then \
-             cp -r ~/.config/$@/* $@; \
+             cp -r $(XDG_CONFIG_HOME)/$@/* $@; \
            else \
-             cp -r ~/.config/$@ $@; \
+             cp -r $(XDG_CONFIG_HOME)/$@ $@; \
            fi; \
-           rm -r ~/.config/$@; \
-       fi; 
-       ln -sfT $(APATH)/$@ ~/.config/$@
+           rm -r $(XDG_CONFIG_HOME)/$@; \
+       fi;
+       ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@