-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
72 lines (63 loc) · 2.12 KB
/
Makefile
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
STOW_PACKAGES := dots git zsh fish nvim config vscode windsurf local
YELLOW := \033[33m
GREEN := \033[32m
WHITE := \033[37m
CLR := \033[0m
.PHONY: default
default: help
.PHONY: help
help: ## Show this help message (default)
@awk 'BEGIN {FS = ":.*?## "}; \
/^[^\t][a-zA-Z0-9_-]+:.*?##/ \
{ printf "\033[36m%-24s$(CLR) %s\n", $$1, $$2 } \
/^##/ { printf "$(YELLOW)%s$(CLR)\n", substr($$0, 4) }' $(MAKEFILE_LIST)
.PHONY: install
install: ## Bootstraps a new machine
@echo "$(YELLOW)Running bootstrap to provision the system...$(CLR)"
@./install.sh
@echo "$(GREEN)System provisioning complete!$(CLR)"
.PHONY: run
run: ## Symlink all dotfiles w/Stow
@for pkg in $(STOW_PACKAGES); do \
stow $$pkg; \
done
@echo "Dotfiles stowed successfully"
.PHONY: stow add
stow: ## Add individual packages w/Stow
@if [ -z "${pkg}" ]; then \
echo "Error: Please specify a package to stow. \n$(YELLOW)ie: $(YELLOW)make stow pkg=<packageName>$(CLR) \n$(WHITE)Available packages:$(CLR) $(STOW_PACKAGES)"; \
exit 1; \
fi
@if [[ ! " ${STOW_PACKAGES} " =~ " ${pkg} " ]]; then \
echo "Error: Package '${pkg}' not found in STOW_PACKAGES: $(STOW_PACKAGES)"; \
exit 1; \
fi
stow ${pkg}
@echo "${pkg} was added"
.PHONY: unstow remove
unstow: ## Remove individual packages w/Stow
@if [ -z "${pkg}" ]; then \
echo "Error: Please specify a package to unstow. \n$(YELLOW)ie: $(YELLOW)make unstow pkg=<packageName>$(CLR) \n$(WHITE)Available packages:$(CLR) $(STOW_PACKAGES)"; \
exit 1; \
fi
@if [[ ! " ${STOW_PACKAGES} " =~ " ${pkg} " ]]; then \
echo "Error: Package '${pkg}' not found in STOW_PACKAGES: $(STOW_PACKAGES)"; \
exit 1; \
fi
stow --delete ${pkg}
@echo "${pkg} was removed"
.PHONY: update up
update:
@for pkg in $(STOW_PACKAGES); do \
stow --restow $$pkg; \
done
@echo "$(GREEN)Dotfiles updated successfully$(CLR) - run $(YELLOW)reload$(CLR) to apply changes to Fish"
.PHONY: delete
delete: ## Delete all dotfiles w/Stow
@for pkg in $(STOW_PACKAGES); do \
stow --delete $$pkg; \
done
@echo "$(WHITE)Dotfiles zapped! ⚡️"
up: update ## Same as update command
add: stow ## Same as stow command
remove: unstow ## Same as unstow command