APATH := $(realpath .)
+XDG_CONFIG_HOME ?= ~/.config
+XDG_DATA_HOME ?= ~/.local/share
+
FILES := bin
DOTFILES := goobookrc msmtp* profile tmux.conf weechat Xresources
CONFIGFILES := compton.conf mpv offlineimap ranger retroarch xbindkeys xkb
.PHONY: install $(FILES) $(DOTFILES) $(CONFIGFILES)
install: $(FILES) $(DOTFILES) $(CONFIGFILES)
-~/.config:
- mkdir -p ~/.config
+$(XDG_DATA_HOME) $(XDG_CONFIG_HOME):
+ mkdir -p $@
-task: ~/.config
- ln -sfT $(APATH)/taskrc ~/.config/taskrc
+task: $(XDG_CONFIG_HOME)
+ ln -sfT $(APATH)/taskrc $(XDG_CONFIG_HOME)/taskrc
-git: ~/.config
- ln -sfT $(APATH)/git ~/.config/git
- ln -sfT $(APATH)/tig ~/.config/tig
+git: $(XDG_CONFIG_HOME)
+ ln -sfT $(APATH)/git $(XDG_CONFIG_HOME)/git
+ ln -sfT $(APATH)/tig $(XDG_CONFIG_HOME)/tig
.PHONY: git
-vim: ~/.config
- ln -sfT $(APATH)/vim ~/.config/vim
- mkdir -p ~/.local/share/vim
- git clone https://github.com/gmarik/vundle ~/.local/share/vim/vundle
+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
-mutt: ~/.config
- ln -sfT $(APATH)/mutt ~/.config/mutt
+mutt: $(XDG_CONFIG_HOME)
+ ln -sfT $(APATH)/mutt $(XDG_CONFIG_HOME)/mutt
.PHONY: mutt
gdb:
- mkdir ~/.local/share/gdb
+ mkdir $(XDG_DATA_HOME)/gdb
ln -sfT $(APATH)/gdbinit ~/.gdbinit
ln -sfT $(APATH)/cgdb ~/.cgdb
.PHONY: gdb
-awesome: ~/.config
- ln -sfT $(APATH)/awesome ~/.config/awesome
+awesome: $(XDG_CONFIG_HOME)
+ ln -sfT $(APATH)/awesome $(XDG_CONFIG_HOME)/awesome
.PHONY: awesome
-qutebrowser: ~/.config
- ln -sfT $(APATH)/qutebrowser ~/.config/qutebrowser
+qutebrowser: $(XDG_CONFIG_HOME)
+ ln -sfT $(APATH)/qutebrowser $(XDG_CONFIG_HOME)/qutebrowser
mkdir -p ~/downloads
.PHONY: qutebrowser
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: ~/.config
- ln -sfT $(APATH)/ncmpcpp ~/.config/ncmpcpp
- mkdir -p ~/.local/share/mpd/lyrics
+ncmpcpp: $(XDG_CONFIG_HOME)
+ ln -sfT $(APATH)/ncmpcpp $(XDG_CONFIG_HOME)/ncmpcpp
+ mkdir -p $(XDG_DATA_HOME)/mpd/lyrics
.PHONY: ncmpcpp
-systemd: ~/.config
- ln -sfT $(APATH)/$@ ~/.config/$@
+systemd: $(XDG_CONFIG_HOME)
+ ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@
.PHONY: systemd
gnupg: systemd
- ln -sfT $(APATH)/$@ ~/.config/$@
+ 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
-zsh: ~/.config
+zsh: $(XDG_CONFIG_HOME)
ln -sfT $(APATH)/zshrc ~/.zshrc
ln -sfT $(APATH)/zprofile ~/.zprofile
ln -sfT $(APATH)/zshenv ~/.zshenv
- ln -sfT $(APATH)/zsh ~/.config/zsh
- ln -sfT $(APATH)/aliases ~/.config/aliases
+ ln -sfT $(APATH)/zsh $(XDG_CONFIG_HOME)/zsh
+ ln -sfT $(APATH)/aliases $(XDG_CONFIG_HOME)/aliases
mkdir -p ~/.cache/zsh
.PHONY: zsh
ln -sfT $(APATH)/xprofile ~/.xprofile
.PHONY: xprofile
-dircolors: ~/.config
- ln -sfT $(APATH)/dircolors ~/.config/dircolors
+dircolors: $(XDG_CONFIG_HOME)
+ ln -sfT $(APATH)/dircolors $(XDG_CONFIG_HOME)/dircolors
.PHONY: dircolors
-urxvt: ~/.config
- ln -sfT $(APATH)/urxvt ~/.config/urxvt
+urxvt: $(XDG_CONFIG_HOME)
+ ln -sfT $(APATH)/urxvt $(XDG_CONFIG_HOME)/urxvt
.PHONY: urxvt
$(FILES):
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/$@; \
+ rm -r $(XDG_CONFIG_HOME)/$@; \
fi;
- ln -sfT $(APATH)/$@ ~/.config/$@
+ ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@