-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (35 loc) · 1.09 KB
/
Makefile
File metadata and controls
45 lines (35 loc) · 1.09 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
MAKEFLAGS += --no-print-directory
include configuration.mk
include makefiles/*.mk
.DEFAULT_GOAL := all
.PHONY: bootstrap $(BOOTSTRAPS) $(DOTFILES) dotfiles-status
$(DOTFILES):
@dst="$@"; \
repo_dir="$(CURDIR)"; \
reference_file="$${dst#$(HOME)/}"; \
reference="$$repo_dir/$$reference_file"; \
dst_reference="$$(readlink "$$dst" 2>/dev/null || true)"; \
if [ -L "$$dst" ] && [ "$$dst_reference" = "$$reference" ]; then \
exit 0; \
fi; \
if [ -e "$$dst" ] || [ -L "$$dst" ]; then \
backup="$$dst-$$(date "+%F-%T")"; \
mv "$$dst" "$$backup" && echo "Backup $$dst to $$backup"; \
fi; \
mkdir -p "$$(dirname "$$dst")"; \
echo "Link ~/$$reference_file to $$reference"; \
ln -s "$$reference" "$$dst"
dotfiles-status:
@echo "Sync dotfiles"
dotfiles: dotfiles-status $(DOTFILES)
bootstrap: $(BOOTSTRAPS)
.PHONY: $(PACKAGES)
$(PACKAGES):
@$(MAKE) package PACKAGE=$@
packages: $(PACKAGES)
.PHONY: $(APPLIES)
apply: bootstrap $(APPLIES)
.PHONY: all
all: bootstrap packages dotfiles apply
@printf "\nRun 'make ai' to install AI agents, CLI tools, plugins, and curated skills.\n"
update: git-pull all