makefile: more sensitive error messages

This commit is contained in:
Danny O'Brien 2023-12-13 01:03:47 -08:00
parent 76c5e94098
commit 4f62a83f1b
2 changed files with 13 additions and 18 deletions

View file

@ -1,29 +1,23 @@
# Define the source directory, read from the environment variable ALMANACK_ROOT
# Ensure to handle the case where ALMANACK_ROOT is not set
SRC_DIR := $(ALMANACK_ROOT)/web/
DEST := boat:/var/local/www/www.almnck.com/
# Define the rsync options
RSYNC_OPTS := -avz --delete
# Define the default target, so it does nothing if just 'make' is run
.PHONY: default
default:
@echo "Please specify a target to run, e.g., 'make live' for live deployment."
# Define the 'live' target which will be triggered on 'make live'
.PHONY: live
live:
# 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 export it before running 'make live'.)
$(error ALMANACK_ROOT is undefined. Please run `source bin/a-activate` before running any targets.)
endif
@rsync $(RSYNC_OPTS) $(SRC_DIR) $(DEST)
# Define the 'live' target which will be triggered on 'make live'
RSYNC_OPTS := -avz --delete
DEST := boat:/var/local/www/www.almnck.com/
.PHONY: live
live: check-activated
@rsync $(RSYNC_OPTS) $(ALMANACK_ROOT)/web/ $(DEST)
.PHONY: test-doc
test-doc:
ifndef ALMANACK_ROOT
$(error ALMANACK_ROOT is undefined. Please export it before running 'make test-doc'.)
endif
test-doc: check-activated
@echo Running doc-check-links
@sh $(ALMANACK_ROOT)/src/tests/doc-check-links | tapview

View file

@ -45,4 +45,5 @@ PASSWORD_STORE_DIR=$ALMANACK_ROOT/secrets/ pass $*
a-deactivate() {
deactivate
unset -f cd
unset ALMANACK_ROOT
}