2023-01-27 11:29:28 +00:00
|
|
|
LOCAL_BIN := $(HOME)/.local/bin
|
|
|
|
CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
|
|
|
|
SYSTEMD_DIR := $(CONFIG_DIR)/systemd/user
|
|
|
|
FONT_DIR := $(HOME)/.local/share/fonts
|
|
|
|
ZSH_DIR := $(if $(ZSH), $(ZSH), $(HOME)/.oh-my-zsh)
|
2023-01-28 18:57:46 +00:00
|
|
|
ZSH_CUSTOM_DIR := $(if $(ZSH_CUSTOM), $(ZSH_CUSTOM), $(ZSH_DIR)/custom)
|
2023-01-27 11:29:28 +00:00
|
|
|
|
|
|
|
CONFIG_ITEMS := $(wildcard config/*)
|
|
|
|
CONFIG_TARGETS := $(CONFIG_ITEMS:config/%=$(CONFIG_DIR)/%)
|
|
|
|
SYSTEMD_ITEMS := $(wildcard systemd/*)
|
|
|
|
SYSTEMD_TARGETS := $(SYSTEMD_ITEMS:systemd/%=$(SYSTEMD_DIR)/%)
|
|
|
|
FONT_ITEMS := $(wildcard nerdfont_symbols/*)
|
|
|
|
FONT_TARGETS := $(FONT_ITEMS:nerdfont_symbols/%=$(FONT_DIR)/%)
|
|
|
|
BIN_ITEMS := $(wildcard bin/*)
|
|
|
|
BIN_TARGETS := $(BIN_ITEMS:bin/%=$(LOCAL_BIN)/%)
|
|
|
|
ZSH_ITEMS := $(wildcard *.zsh)
|
2023-01-27 19:36:54 +00:00
|
|
|
ZSH_TARGETS := $(ZSH_ITEMS:%.zsh=$(ZSH_CUSTOM_DIR)/%.zsh)
|
2023-01-27 11:29:28 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-01-28 18:57:46 +00:00
|
|
|
.PHONY := all force clean config zsh nvim
|
2023-01-27 14:00:09 +00:00
|
|
|
|
2023-01-28 18:57:46 +00:00
|
|
|
all: config zsh nvim
|
2023-01-27 11:29:28 +00:00
|
|
|
|
|
|
|
force: clean all
|
|
|
|
|
|
|
|
clean:
|
2023-01-28 22:22:12 +00:00
|
|
|
curl -sSL https://install.python-poetry.org | python3 - --uninstall
|
2023-01-27 11:29:28 +00:00
|
|
|
|
2023-01-28 18:57:46 +00:00
|
|
|
config: $(CONFIG_TARGETS) $(SYSTEMD_TARGETS)
|
2023-01-27 11:29:28 +00:00
|
|
|
|
2023-01-27 19:36:54 +00:00
|
|
|
zsh: $(ZSH_DIR) $(ZSH_CUSTOM_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS)
|
|
|
|
|
2023-01-28 18:57:46 +00:00
|
|
|
nvim: $(PACKER_DIR)
|
|
|
|
|
2023-01-27 11:29:28 +00:00
|
|
|
$(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/%
|
|
|
|
$(SYSTEMD_TARGETS): $(SYSTEMD_DIR)/%: systemd/%
|
|
|
|
$(FONT_TARGETS): $(FONT_DIR)/%: nerdfont_symbols/%
|
2023-01-27 19:36:54 +00:00
|
|
|
$(ZSH_TARGETS): $(ZSH_CUSTOM_DIR)/%.zsh: %.zsh
|
|
|
|
$(CONFIG_TARGETS) $(SYSTEMD_TARGETS) $(FONT_TARGETS) $(ZSH_TARGETS):
|
2023-01-27 11:29:28 +00:00
|
|
|
ln -s $(PWD)/$? $@
|
|
|
|
|
|
|
|
$(BIN_TARGETS): $(LOCAL_BIN)/%: bin/%
|
|
|
|
command -v $? 2> /dev/null || ln -s $(PWD)$? $@
|
|
|
|
|
2023-01-28 22:22:12 +00:00
|
|
|
$(LOCAL_BIN)/poetry: $(LOCAL_BIN)
|
|
|
|
command -v poetry > /dev/null || curl -sSL https://install.python-poetry.org | python3 -
|
|
|
|
|
2023-01-27 11:29:28 +00:00
|
|
|
$(HOME)/.ssh/config: $(HOME)/.ssh
|
2023-01-27 13:29:11 +00:00
|
|
|
cp -n templates/ssh-config $@
|
2023-01-27 11:29:28 +00:00
|
|
|
|
|
|
|
$(PACKER_DIR):
|
|
|
|
git clone --depth 1 $(PACKER_REPO) $@
|
|
|
|
|
|
|
|
$(ZSH_DIR):
|
2023-01-28 18:57:46 +00:00
|
|
|
sh -c "$$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
2023-01-27 11:29:28 +00:00
|
|
|
|
|
|
|
$(ZSH_CUSTOM_DIR): $(ZSH_DIR)
|
|
|
|
|
2023-01-27 19:36:54 +00:00
|
|
|
$(POWERLEVEL_DIR):
|
2023-01-27 11:29:28 +00:00
|
|
|
git clone --depth 1 $(POWERLEVEL_REPO) $@
|
|
|
|
|
|
|
|
$(HOME)/.gitconfig:
|
|
|
|
grep "editor" $@ > /dev/null || git config --global core.editor "nvim"
|
|
|
|
grep "pull.rebase" $@ > /dev/null || git config --global pull.rebase false
|
|
|
|
|
|
|
|
$(LOCAL_BIN) $(CONFIG_DIR) $(SYSTEMD_DIR) $(FONT_DIR) $(HOME)/.ssh $(HOME)/.ssh/sockets:
|
|
|
|
mkdir -p $@
|