X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/b8e3329e0fc239135eaa3b0ab8477aec8af277c3..a59aa3f7d15dae57e2d066e47af3556c46d9dac4:/Makefile diff --git a/Makefile b/Makefile index df88294..5a64e88 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,213 @@ APATH := $(realpath .) +XDG_CONFIG_HOME ?= ~/.config +XDG_CACHE_HOME ?= ~/.cache +XDG_DATA_HOME ?= ~/.local/share + 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 mpd +DOTFILES := goobookrc profile Xresources +CONFIGFILES := mpv offlineimap ranger retroarch xbindkeys xkb + +.PHONY: core_files +core_files: dircolors git nvim ranger ssh systemd tmux zsh + +.PHONY: desktop +desktop: core_files awesome kitty picom qutebrowser rofi xkb .PHONY: install $(FILES) $(DOTFILES) $(CONFIGFILES) install: $(FILES) $(DOTFILES) $(CONFIGFILES) -$(FILES): +$(XDG_DATA_HOME) $(XDG_CONFIG_HOME): + mkdir -p $@ + +awesome: $(XDG_CONFIG_HOME) xinit + ln -sfT $(APATH)/awesome $(XDG_CONFIG_HOME)/awesome + ln -sfT $(APATH)/zlogin ~/.zlogin + git submodule update --init \ + awesome/widgets/pomodoro \ + awesome/widgets/net_widgets +.PHONY: awesome + +dircolors: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/dircolors $(XDG_CONFIG_HOME)/dircolors +.PHONY: dircolors + +gdb: $(XDG_CACHE_HOME) $(XDG_DATA_HOME) + mkdir $(XDG_DATA_HOME)/gdb + ln -sfT $(APATH)/gdb $(XDG_CONFIG_HOME)/gdb +.PHONY: gdb + +git: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/git $(XDG_CONFIG_HOME)/git + ln -sfT $(APATH)/tig $(XDG_CONFIG_HOME)/tig +.PHONY: git + +gnupg: systemd + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ + chmod 700 $(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 + sudo ln -sfT $(APATH)/bin/pinentry /usr/local/bin/pinentry +.PHONY: gnupg + +khal: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: khal + +khard: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: khard + +kitty: + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: kitty + +mpd: systemd + 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 + +mbsync: + ln -sfT $(APATH)/mbsync $(XDG_CONFIG_HOME)/mbsync +.PHONY: mbsync + +msmtp: + ln -sfT $(APATH)/msmtprc ~/.msmtprc + ln -sfT $(APATH)/msmtp ~/.msmtp +.PHONY: msmtp + +mutt: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/mutt $(XDG_CONFIG_HOME)/mutt +.PHONY: mutt + +mail: mbsync msmtp mutt +.PHONY: mail + +ncmpcpp: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/ncmpcpp $(XDG_CONFIG_HOME)/ncmpcpp + mkdir -p $(XDG_DATA_HOME)/mpd/lyrics +.PHONY: ncmpcpp + +pacman: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: pacman + +picom: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: picom + +qute_scripts := $(wildcard qutebrowser/userscripts/*) +$(qute_scripts): + mkdir -p $(XDG_DATA_HOME)/qutebrowser/userscripts + ln -sfT $(APATH)/$@ $(XDG_DATA_HOME)/$@ +.PHONY: $(qute_scripts) + +qutebrowser: $(XDG_CONFIG_HOME) $(qute_scripts) + ln -sfT $(APATH)/qutebrowser $(XDG_CONFIG_HOME)/qutebrowser + mkdir -p ~/downloads +.PHONY: qutebrowser + +rofi: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: rofi + +rofimoji: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/$@.rc $(XDG_CONFIG_HOME)/$@.rc +.PHONY: rofimoji + +ssh: + ln -sfT $(APATH)/ssh/config ~/.ssh/config +.PHONY: ssh + +# copy system files, do not link, it doesn't work if home is encrypted +/etc/systemd/system/%: systemd/system/% + sudo cp $(APATH)/$< $@ + +systemd-system: $(patsubst %,/etc/%,$(wildcard systemd/system/*)) + sudo systemctl daemon-reload +.PHONY: systemd-system + +systemd-user: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: systemd-user + +systemd: systemd-user systemd-system + systemctl --user daemon-reload +.PHONY: systemd + +task: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: task + +tmux: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/tmux $(XDG_CONFIG_HOME)/tmux + git submodule update --init \ + tmux/plugins/nord-tmux \ + tmux/plugins/tpm +.PHONY: tmux + +urxvt: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/urxvt $(XDG_CONFIG_HOME)/urxvt +.PHONY: urxvt + +vdirsyncer: $(XDG_CACHE_HOME) + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ + mkdir -p $(XDG_DATA_HOME)/vdirsyncer/{contacts,calendars} +.PHONY: vdirsyncer + +vim: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/vim $(XDG_CONFIG_HOME)/vim + mkdir -p $(XDG_DATA_HOME)/vim +.PHONY: vim + +nvim: $(XDG_CONFIG_HOME) vim + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: nvim + +yay: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/yay $(XDG_CONFIG_HOME)/yay + mkdir -p $(XDG_CACHE_HOME)/yay + +xinit: $(XDG_CONFIG_HOME) xprofile + ln -sfT $(APATH)/$@rc ~/.$@rc + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: xinit + +xprofile: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/$@ ~/.$@ + ln -sfT $(APATH)/$@.d $(XDG_CONFIG_HOME)/$@.d +.PHONY: xprofile + +wakeonlan: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: wakeonlan + +weechat: $(XDG_CONFIG_HOME) $(XDG_CACHE_HOME) + ln -sfT $(APATH)/weechat $(XDG_CONFIG_HOME)/weechat + mkdir -p $(XDG_CACHE_HOME)/weechat +.PHONY: weechat + +wezterm: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: wezterm + +zathura: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/$@ $(XDG_CONFIG_HOME)/$@ +.PHONY: zathura + +zsh: $(XDG_CONFIG_HOME) + ln -sfT $(APATH)/zshrc ~/.zshrc + 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 + git submodule update --init zsh/lib/zsh-syntax-highlighting +.PHONY: zsh + +$(FILES): @if [[ -e ~/$@ && ! -L ~/$@ ]]; then \ if [[ -d $@ ]]; then \ cp -r ~/$@/* $@; \ @@ -15,10 +215,10 @@ $(FILES): cp -r ~/$@ $@; \ fi; \ rm -r ~/$@; \ - fi; + fi; ln -sfT $(APATH)/$@ ~/$@ -$(DOTFILES): +$(DOTFILES): @if [[ -e ~/.$@ && ! -L ~/.$@ ]]; then \ if [[ -d .$@ ]]; then \ cp -r ~/.$@/* $@; \ @@ -26,16 +226,16 @@ $(DOTFILES): cp -r ~/.$@ $@; \ fi; \ rm -r ~/.$@; \ - fi; + fi; ln -sfT $(APATH)/$@ ~/.$@ -$(CONFIGFILES): - @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)/$@