2023-01-27 11:29:28 +00:00
|
|
|
CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
|
2023-02-09 08:59:12 +00:00
|
|
|
SSH_DIR := $(HOME)/.ssh
|
2023-01-27 11:29:28 +00:00
|
|
|
|
|
|
|
CONFIG_ITEMS := $(wildcard config/*)
|
|
|
|
CONFIG_TARGETS := $(CONFIG_ITEMS:config/%=$(CONFIG_DIR)/%)
|
2023-02-09 08:59:12 +00:00
|
|
|
SSH_ITEMS := $(wildcard ssh/*)
|
|
|
|
SSH_TARGETS := $(SSH_ITEMS:ssh/%=$(SSH_DIR)/%)
|
2023-01-27 11:29:28 +00:00
|
|
|
|
2023-02-17 09:00:12 +00:00
|
|
|
LAZY_REPO := https://github.com/folke/lazy.nvim.git
|
2023-02-17 09:07:24 +00:00
|
|
|
LAZY_DIR := $(HOME)/.local/share/nvim/lazy/lazy.nvim
|
2023-01-27 11:29:28 +00:00
|
|
|
|
2023-02-11 10:02:36 +00:00
|
|
|
.PHONY: all clean link unlink install uninstall pacman
|
2023-02-08 23:54:40 +00:00
|
|
|
|
2023-02-10 08:13:48 +00:00
|
|
|
all: link install
|
2023-02-08 23:54:40 +00:00
|
|
|
|
2023-02-10 08:13:48 +00:00
|
|
|
clean: unlink uninstall
|
2023-02-09 16:05:24 +00:00
|
|
|
|
2023-02-25 08:46:56 +00:00
|
|
|
link: $(HOME)/.profile $(CONFIG_TARGETS) $(SSH_TARGETS) $(HOME)/.ssh/sockets
|
2023-02-10 08:13:48 +00:00
|
|
|
|
|
|
|
unlink:
|
2023-01-30 22:30:02 +00:00
|
|
|
for link in $(CONFIG_TARGETS); do rm "$$link"; done
|
2023-02-10 08:13:48 +00:00
|
|
|
for link in $(SSH_TARGETS); do rm "$$link"; done
|
|
|
|
rmdir $(HOME)/.ssh/sockets
|
2023-02-09 08:53:40 +00:00
|
|
|
|
2023-02-25 08:46:56 +00:00
|
|
|
install: $(LAZY_DIR)
|
2023-02-09 08:53:40 +00:00
|
|
|
|
2023-02-10 08:13:48 +00:00
|
|
|
uninstall:
|
2023-02-17 09:00:12 +00:00
|
|
|
rm -rf $(LAZY_DIR)
|
2023-02-09 22:09:51 +00:00
|
|
|
|
2023-02-11 10:02:36 +00:00
|
|
|
pacman:
|
2023-02-09 22:09:51 +00:00
|
|
|
sort -h pkglist.txt -o pkglist.txt
|
2023-02-10 08:13:48 +00:00
|
|
|
pacman -T - < pkglist.txt ||\
|
|
|
|
sudo pacman --needed -S - < pkglist.txt
|
2023-02-09 22:09:51 +00:00
|
|
|
|
2023-01-27 11:29:28 +00:00
|
|
|
$(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/%
|
2023-02-09 08:59:12 +00:00
|
|
|
$(SSH_TARGETS): $(SSH_DIR)/%: ssh/%
|
2023-02-25 08:46:56 +00:00
|
|
|
$(CONFIG_TARGETS) $(SSH_TARGETS):
|
|
|
|
ln -s $(PWD)/$? $@
|
|
|
|
|
|
|
|
$(HOME)/.profile: .profile
|
2023-02-09 15:52:52 +00:00
|
|
|
ln -s $(PWD)/$? $@
|
2023-01-27 11:29:28 +00:00
|
|
|
|
2023-02-17 09:00:12 +00:00
|
|
|
$(LAZY_DIR):
|
|
|
|
git clone --depth 1 $(LAZY_REPO) $@
|
|
|
|
|
2023-02-10 08:13:48 +00:00
|
|
|
$(CONFIG_DIR) $(SSH_DIR) $(HOME)/.ssh/sockets:
|
2023-01-27 11:29:28 +00:00
|
|
|
mkdir -p $@
|