# Makefile

# Default target
all: stow

# Full Setup
setup:
	bash ./scripts/base.sh 
	bash ./scripts/node.sh
	bash ./scripts/go.sh
	bash ./scripts/rust.sh
	bash ./scripts/python.sh
	bash ./scripts/r.sh
	make clean
	make stow
	@echo "Full setup completed."

base:
	bash ./scripts/base.sh
	@echo "Base setup completed."

# Just stow the dotfiles
stow:
	stow . --target=$$HOME --ignore=".git" --ignore=".gitignore" --ignore="README.md" --ignore=".zsh_secrets" --ignore=".zsh_secrets.example" --ignore="LICENSE" --ignore="Makefile" --ignore="bin" --ignore="scripts"
	@echo "Dotfiles linked."

# Clean old files and links
clean:
	stow -D . --target=$$HOME
	@echo "Links removed."

# Pull Git Updates
update:
	git pull origin main
	make setup

base:
	bash ./scripts/base.sh

# Language Setups
node:
	bash ./scripts/node.sh

go:
	bash ./scripts/go.sh

rust:
	bash ./scripts/rust.sh

python:
	bash ./scripts/python.sh

r:
	bash ./scripts/r.sh

cpp:
	bash ./scripts/cpp.sh

storagebox:
	bash ./scripts/storagebox.sh

# Docker Tests
test-ubuntu:
	@echo "Ubuntu Test"
	docker run -it --rm -e TERM=xterm-256color -v $(PWD):/root/dotfiles ubuntu:latest \
	bash -c "export DEBIAN_FRONTEND=noninteractive && \
	apt-get update && \
	apt-get install -y sudo git make curl && \
	cd /root/dotfiles && \
	make setup"

test-arch:
	@echo "Spawning Arch Container..."
	docker run -it --rm -e TERM=xterm-256color -v $(PWD):/root/dotfiles archlinux:latest \
	bash -c "pacman -Sy --noconfirm base-devel git make sudo && cd /root/dotfiles && make setup"