-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (40 loc) · 1.46 KB
/
Copy pathMakefile
File metadata and controls
47 lines (40 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
DOTFILES_DIR := $(shell pwd)
HOME_DIR := $(HOME)
PACKAGES := zsh git kitty nvim tmux fzf eza mpv aria2 yt-dlp tealdeer scripts p10k karabiner
.PHONY: help stow unstow restow list
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
@echo ""
@echo " Examples:"
@echo " make stow PKG=git Stow only git"
@echo " make unstow PKG=kitty Unstow only kitty"
@echo " make restow Re-stow all packages"
stow: ## Stow a package (PKG=name) or all packages
ifdef PKG
@test -d "$(DOTFILES_DIR)/$(PKG)" || { echo "Error: package '$(PKG)' not found"; exit 1; }
stow -d $(DOTFILES_DIR) -t $(HOME_DIR) $(PKG)
else
@for pkg in $(PACKAGES); do \
echo "Stowing $$pkg..."; \
stow -d $(DOTFILES_DIR) -t $(HOME_DIR) $$pkg; \
done
endif
unstow: ## Unstow a package (PKG=name) or all packages
ifdef PKG
@test -d "$(DOTFILES_DIR)/$(PKG)" || { echo "Error: package '$(PKG)' not found"; exit 1; }
stow -d $(DOTFILES_DIR) -t $(HOME_DIR) -D $(PKG)
else
@for pkg in $(PACKAGES); do \
echo "Unstowing $$pkg..."; \
stow -d $(DOTFILES_DIR) -t $(HOME_DIR) -D $$pkg; \
done
endif
restow: ## Re-stow all packages (clean + re-link)
@for pkg in $(PACKAGES); do \
echo "Re-stowing $$pkg..."; \
stow -d $(DOTFILES_DIR) -t $(HOME_DIR) -R $$pkg; \
done
list: ## List all stow packages
@echo "Available packages:"; \
for pkg in $(PACKAGES); do echo " $$pkg"; done