almnck/Makefile

39 lines
1.4 KiB
Makefile
Raw Normal View History

2025-07-08 21:39:40 -07:00
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:
2025-07-08 21:39:40 -07:00
@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"
2025-07-08 21:39:40 -07:00
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
2025-07-08 21:39:40 -07:00
@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);)
2023-12-13 00:10:12 -08:00
.PHONY: test-doc
test-doc: check-activated
2023-12-13 00:10:12 -08:00
@echo Running doc-check-links
@sh $(ALMANACK_ROOT)/src/tests/doc-check-links | tapview