-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (34 loc) · 1.2 KB
/
Copy pathMakefile
File metadata and controls
38 lines (34 loc) · 1.2 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
DOTFILES := $(filter-out . .. .git .gitignore .config .DS_Store .oh-my-zsh .claude,$(wildcard .??*))
CONFIGFILES := $(shell find .config -type f ! -name ".*" 2>/dev/null)
ZSHTHEMES := $(shell find .oh-my-zsh .zsh-theme -type f ! -name ".*" 2>/dev/null)
INSTRUCTIONFILES := $(shell find .claude -type f ! -name ".*" 2>/dev/null)
ALLFILES := $(DOTFILES) $(CONFIGFILES) $(ZSHTHEMES) $(INSTRUCTIONFILES)
.PHONY: all link clean
all: link
link:
@echo "🔗 Linking dotfiles to $(HOME)..."
@for file in $(ALLFILES); do \
mkdir -p "$$(dirname "$(HOME)/$$file")"; \
dest="$(HOME)/$$file"; \
if [ -L "$$dest" ]; then \
echo " 🔁 Replacing existing symlink: $$dest"; \
rm "$$dest"; \
elif [ -e "$$dest" ]; then \
echo " ⚠️ Skipping (file already exists): $$dest"; \
continue; \
fi; \
ln -s "$$(pwd)/$$file" "$$dest"; \
echo " ✅ Linked $$file → $$dest"; \
done
clean:
@echo "🧹 Removing dotfile symlinks from $(HOME)..."
@for file in $(ALLFILES); do \
dest="$(HOME)/$$file"; \
if [ -L "$$dest" ]; then \
rm "$$dest"; \
echo " ❌ Removed symlink: $$dest"; \
elif [ -e $$dest ]; then \
echo " ⚠️ Skipping (file already exists): $$dest"; \
continue; \
fi; \
done