55 lines
1.9 KiB
Makefile
55 lines
1.9 KiB
Makefile
LOCAL_BIN := $(HOME)/.local/bin
|
|
CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
|
|
FONT_DIR := $(HOME)/.local/share/fonts
|
|
ZSH_DIR := $(if $(ZSH), $(ZSH), $(HOME)/.oh-my-zsh)
|
|
ZSH_CUSTOM_DIR := $(if $(ZSH_CUSTOM), $(ZSH_CUSTOM), $(ZSH_DIR)/custom)
|
|
|
|
CONFIG_ITEMS := $(wildcard config/*)
|
|
CONFIG_TARGETS := $(CONFIG_ITEMS:config/%=$(CONFIG_DIR)/%)
|
|
FONT_ITEMS := $(wildcard nerdfont_symbols/*)
|
|
FONT_TARGETS := $(FONT_ITEMS:nerdfont_symbols/%=$(FONT_DIR)/%)
|
|
ZSH_ITEMS := $(wildcard *.zsh)
|
|
ZSH_TARGETS := $(ZSH_ITEMS:%.zsh=$(ZSH_CUSTOM_DIR)/%.zsh)
|
|
|
|
PACKER_REPO := https://github.com/wbthomason/packer.nvim
|
|
PACKER_DIR := $(HOME)/.local/share/nvim/site/pack/packer/start/packer.nvim
|
|
POWERLEVEL_REPO := https://github.com/romkatv/powerlevel10k.git
|
|
POWERLEVEL_DIR := $(ZSH_CUSTOM_DIR)/themes/powerlevel10k
|
|
|
|
.PHONY := config clean zsh ssh
|
|
|
|
config: $(CONFIG_TARGETS) zsh ssh
|
|
|
|
clean:
|
|
for link in $(CONFIG_TARGETS); do rm "$$link"; done
|
|
for link in $(FONT_TARGETS); do rm "$$link"; done
|
|
for link in $(ZSH_TARGETS); do rm "$$link"; done
|
|
rm $(HOME)/.ssh/config
|
|
rm -rf $(PACKER_DIR)
|
|
rm -rf $(POWERLEVEL_DIR)
|
|
|
|
zsh: $(ZSH_DIR) $(ZSH_CUSTOM_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS) $(HOME)/.zprofile
|
|
|
|
ssh: $(HOME)/.ssh/config $(HOME)/.ssh/sockets $(HOME)/.ssh/config.d
|
|
|
|
$(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/%
|
|
$(FONT_TARGETS): $(FONT_DIR)/%: nerdfont_symbols/%
|
|
$(ZSH_TARGETS): $(ZSH_CUSTOM_DIR)/%.zsh: %.zsh
|
|
$(HOME)/.ssh/config: $(HOME)/.ssh/%: ssh-%
|
|
$(CONFIG_TARGETS) $(FONT_TARGETS) $(ZSH_TARGETS) $(HOME)/.ssh/config:
|
|
ln -s $(PWD)/$? $@
|
|
|
|
$(PACKER_DIR):
|
|
git clone --depth 1 $(PACKER_REPO) $@
|
|
|
|
$(ZSH_DIR):
|
|
sh -c "$$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
|
|
|
$(ZSH_CUSTOM_DIR): $(ZSH_DIR)
|
|
|
|
$(POWERLEVEL_DIR):
|
|
git clone --depth 1 $(POWERLEVEL_REPO) $@
|
|
|
|
$(LOCAL_BIN) $(CONFIG_DIR) $(FONT_DIR) $(HOME)/.ssh $(HOME)/.ssh/sockets $(HOME)/.ssh/config.d:
|
|
mkdir -p $@
|