RED := \033[0;31m GREEN := \033[0;32m YELLOW := \033[0;33m BLUE := \033[0;34m MAGENTA := \033[0;35m CYAN := \033[0;36m WHITE := \033[0;37m BOLD := \033[1m RESET := \033[0m .PHONY: default default: @echo "$(RED)Please specify a target to run, e.g., 'make live' for live deployment.$(RESET)" # Define a common rule to check if ALMANACK_ROOT is set .PHONY: check-activated check-activated: ifndef ALMANACK_ROOT $(error ALMANACK_ROOT is undefined. Please run `source bin/a-activate` before running any targets.) endif # Define the 'live' target which will be triggered on 'make live' RSYNC_OPTS := -avz --delete --delete-after --filter='dir-merge,-n /.gitignore' -e "a-ssh" DESTINATIONS := boat:/var/local/www/www.almnck.com/ dallas:/var/local/www/www.almnck.com/ sj:/var/local/www/www.almnck.com/ .PHONY: live live: check-activated @test -d "$(ALMANACK_ROOT)/web" || (echo "ERROR: web directory not found" && exit 1) @echo "Dry run preview:" @$(foreach dest,$(DESTINATIONS),echo "$(BLUE)To $(dest)$(RESET)"; rsync $(RSYNC_OPTS) --dry-run $(ALMANACK_ROOT)/web/ $(dest);) @read -p "Continue with deployment? (y/N): " confirm && [ "$$confirm" = "y" ] @$(foreach dest,$(DESTINATIONS),echo "$(BLUE)To $(dest)$(RESET)"; rsync $(RSYNC_OPTS) $(ALMANACK_ROOT)/web/ $(dest);) .PHONY: test-doc test-doc: check-activated @echo Running doc-check-links @sh $(ALMANACK_ROOT)/src/tests/doc-check-links | tapview