summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-01-26 18:31:06 -0600
committerCraig Jennings <c@cjennings.net>2026-01-26 18:31:06 -0600
commitdf6b5e294d9cd6d23884726546a481803e63545e (patch)
tree9ae68a2afa4e20aacf5149978c708fa5a5bd2d1d /Makefile
parent7a645b9cb79e75ae439c89e76346e17c1fbe427e (diff)
feat: add Makefile for GNU Stow dotfile management
Targets: - stow: Create symlinks (fresh install) - restow: Refresh symlinks after git pull - adopt: Pull system files, reset to repo version - unstow: Remove all symlinks Usage: make <target> <de> make stow dwm make restow hyprland make adopt dwm Shows help if DE argument missing. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile76
1 files changed, 76 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..da4e3c2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,76 @@
+# Makefile for archsetup dotfiles
+# GNU Stow operations for managing dotfiles
+
+STOW := stow --target=$(HOME) --no-folding
+DOTFILES := $(shell pwd)/dotfiles
+
+# Extract DE from command line (e.g., 'make stow dwm' -> DE=dwm)
+DE := $(filter dwm hyprland,$(MAKECMDGOALS))
+
+.PHONY: help stow restow adopt unstow dwm hyprland
+
+# Default target - show help
+help:
+ @echo "Dotfiles Management (GNU Stow)"
+ @echo ""
+ @echo "Usage: make <target> <de>"
+ @echo ""
+ @echo "Desktop Environments:"
+ @echo " dwm X11/DWM setup (stows: common + dwm)"
+ @echo " hyprland Wayland/Hyprland setup (stows: common + hyprland)"
+ @echo ""
+ @echo "Targets:"
+ @echo " stow Create symlinks (fresh install)"
+ @echo " restow Refresh symlinks (unlink + relink)"
+ @echo " adopt Pull system files into repo, then reset to repo version"
+ @echo " unstow Remove all symlinks"
+ @echo ""
+ @echo "Examples:"
+ @echo " make stow dwm # Fresh DWM install"
+ @echo " make stow hyprland # Fresh Hyprland install"
+ @echo " make restow dwm # Refresh DWM links after git pull"
+ @echo " make adopt hyprland # Resolve conflicts, keep repo version"
+ @echo ""
+
+# Prevent 'dwm' and 'hyprland' from being treated as file targets
+dwm hyprland:
+ @:
+
+# Validate DE was provided
+check-de:
+ifeq ($(DE),)
+ @echo "Error: Desktop environment required."
+ @echo ""
+ @$(MAKE) --no-print-directory help
+ @exit 1
+endif
+
+# Stow - create symlinks
+stow: check-de
+ @echo "Stowing common + $(DE)..."
+ @cd $(DOTFILES) && $(STOW) common
+ @cd $(DOTFILES) && $(STOW) $(DE)
+ @echo "Done."
+
+# Restow - refresh symlinks (unlink + relink)
+restow: check-de
+ @echo "Restowing common + $(DE)..."
+ @cd $(DOTFILES) && $(STOW) --restow common
+ @cd $(DOTFILES) && $(STOW) --restow $(DE)
+ @echo "Done."
+
+# Adopt - pull system files into repo, then reset to repo version
+adopt: check-de
+ @echo "Adopting common + $(DE)..."
+ @cd $(DOTFILES) && $(STOW) --adopt common
+ @cd $(DOTFILES) && $(STOW) --adopt $(DE)
+ @echo "Resetting adopted files to repo version..."
+ @git checkout -- dotfiles/
+ @echo "Done. Symlinks created, repo unchanged."
+
+# Unstow - remove symlinks
+unstow: check-de
+ @echo "Unstowing common + $(DE)..."
+ @cd $(DOTFILES) && $(STOW) --delete common
+ @cd $(DOTFILES) && $(STOW) --delete $(DE)
+ @echo "Done."