special_files := git nvim tmux zsh simple_files := emacs spacemacs doom-emacs vim fish picom qutebrowser kak pkg_dependent_files := basics i3wm bspwm herbstluftwm xmonad x polybar all_files := $(special_files) $(simple_files) $(pkg_dependent_files) .PHONY: $(all_files) MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) BASE_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH))) stow_dir = stow -t ~ $(1) unstow = stow -Dt ~ $(1) aur_install = pacman -Q $(1) || (git clone aur:$(1) && pushd $(1) && makepkg -si && popd) pkg_install = pacman -Q $(1) || sudo pacman -S $(1) check_install_deps = pacman -Q - < meta/$(1)_deps || paru -S --needed - < meta/$(1)_deps $(simple_files): $(call stow_dir,$@) $(pkg_dependent_files): paru $(call check_install_deps,$@) $(call stow_dir,$@) # special install rules git: $(call pkg_install,$@) $(call stow_dir,$@) yay: git $(call aur_install,$@) paru: git $(call aur_install,$@) $(call stow_dir,$@) tmux: yay $(call check_install_deps,powerline) $(call stow_dir,$@) nvim: curl -fLo nvim/.config/nvim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim $(call stow_dir,$@) zsh: basics antibody $(call stow_dir,$@) antibody: $(BASE_DIR)/zsh/.config/zsh/zsh_plugins.txt curl -sfL git.io/antibody | sh -s - -b $(BASE_DIR)/zsh/.local/bin $(BASE_DIR)/zsh/.local/bin/antibody bundle < $(BASE_DIR)/zsh/.config/zsh/zsh_plugins.txt > $(BASE_DIR)/zsh/.config/zsh/zsh_plugins.sh $(addprefix uninstall_,$(all_files)): $(call unstow,$(subst uninstall_,,$@)) uninstall_%: $(call unstow,$*)