Simplify Makefile and separate (un)linking and (un)installing capabilities

This commit is contained in:
Evie Litherland-Smith 2023-02-10 08:13:48 +00:00
parent 3920a4f778
commit 4fa3f61091

View file

@ -21,37 +21,32 @@ POWERLEVEL_DIR := $(ZSH_CUSTOM_DIR)/themes/powerlevel10k
TPM_REPO := https://github.com/tmux-plugins/tpm TPM_REPO := https://github.com/tmux-plugins/tpm
TPM_DIR := $(HOME)/.tmux/plugins/tpm TPM_DIR := $(HOME)/.tmux/plugins/tpm
.PHONY: install nopackages clean home packages config zsh ssh nvim tmux sort .PHONY: all clean link unlink install uninstall packages
install: home packages config zsh ssh nvim tmux all: link install
nopackages: home config zsh ssh nvim clean: unlink uninstall
clean: link: $(HOME_TARGETS) $(CONFIG_TARGETS) $(SSH_TARGETS) $(HOME)/.ssh/sockets
unlink:
for link in $(HOME_TARGETS); do rm "$$link"; done for link in $(HOME_TARGETS); do rm "$$link"; done
for link in $(CONFIG_TARGETS); do rm "$$link"; done for link in $(CONFIG_TARGETS); do rm "$$link"; done
rm $(HOME)/.ssh/config for link in $(SSH_TARGETS); do rm "$$link"; done
rm -rf $(PACKER_DIR) rmdir $(HOME)/.ssh/sockets
rm -rf $(ZSH_DIR)
home: $(HOME_TARGETS) install: packages $(ZSH_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS) $(PACKER_DIR) $(TPM_DIR)
python3 -m pip list | grep -E "libtmux.*0\.16\.1" > /dev/null ||\
packages:
pacman -T - < pkglist.txt || sudo pacman --needed -S - < pkglist.txt
config: $(CONFIG_TARGETS) $(TPM_DIR)
zsh: $(ZSH_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS)
ssh: $(SSH_TARGETS) $(HOME)/.ssh/sockets
nvim: $(PACKER_DIR)
tmux:
python3 -m pip install --user libtmux==0.16.1 python3 -m pip install --user libtmux==0.16.1
sort: uninstall:
rm -rf $(ZSH_DIR)
rm -rf $(PACKER_DIR)
packages:
sort -h pkglist.txt -o pkglist.txt sort -h pkglist.txt -o pkglist.txt
pacman -T - < pkglist.txt ||\
sudo pacman --needed -S - < pkglist.txt
$(HOME_TARGETS): $(HOME)/.%: home/% $(HOME_TARGETS): $(HOME)/.%: home/%
$(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/% $(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/%
@ -72,5 +67,5 @@ $(TPM_DIR):
$(ZSH_DIR): $(ZSH_DIR):
sh -c "$$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" sh -c "$$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
$(CONFIG_DIR) $(FONT_DIR) $(SSH_DIR) $(HOME)/.ssh/sockets: $(CONFIG_DIR) $(SSH_DIR) $(HOME)/.ssh/sockets:
mkdir -p $@ mkdir -p $@