2019-04-13 18:58:56 +02:00
|
|
|
# Hugo configuration.
|
|
|
|
HUGO_COMMAND := hugo
|
2022-04-01 14:17:04 +02:00
|
|
|
HUGO_OPTIONS := --printI18nWarnings --minify
|
2018-04-29 17:11:44 +02:00
|
|
|
|
2019-04-13 18:58:56 +02:00
|
|
|
OUTPUT_DIR := public
|
2018-04-29 17:11:44 +02:00
|
|
|
|
2019-04-13 18:58:56 +02:00
|
|
|
# Vnu validator configuration.
|
|
|
|
VNU_COMMAND := vnu
|
|
|
|
VNU_OPTIONS := --skip-non-html --also-check-css
|
2018-04-29 22:53:53 +02:00
|
|
|
|
2019-04-13 18:58:56 +02:00
|
|
|
# Rsync deployment configuration.
|
|
|
|
SSH_HOST := www.cosin.ch
|
2021-01-02 05:42:02 +01:00
|
|
|
SSH_USER := webcosin
|
2019-04-13 18:58:56 +02:00
|
|
|
TARGET_DIR := /srv/www/www.cosin.ch/
|
2018-04-29 17:11:44 +02:00
|
|
|
|
2019-04-13 18:58:56 +02:00
|
|
|
# Non-file goals.
|
|
|
|
.PHONY: server generate validate upload clean
|
2018-04-29 17:11:44 +02:00
|
|
|
|
2019-04-13 18:58:56 +02:00
|
|
|
# Include the configuration files.
|
|
|
|
-include config.mk settings.mk
|
2018-04-29 17:11:44 +02:00
|
|
|
|
2019-04-13 18:58:56 +02:00
|
|
|
# Start a local development server.
|
2018-04-29 18:40:29 +02:00
|
|
|
server:
|
2019-04-13 18:58:56 +02:00
|
|
|
hugo $(HUGO_OPTIONS) server
|
|
|
|
|
|
|
|
# Generate static output files for deployment.
|
|
|
|
generate:
|
|
|
|
hugo $(HUGO_OPTIONS)
|
|
|
|
|
|
|
|
# Validate html and css in generated files.
|
|
|
|
validate: generate
|
|
|
|
$(VNU_COMMAND) $(VNU_OPTIONS) $(OUTPUT_DIR)
|
2018-04-29 18:40:29 +02:00
|
|
|
|
2019-04-13 18:58:56 +02:00
|
|
|
# Deploy the website to the production webserver.
|
2018-04-29 17:11:44 +02:00
|
|
|
upload: generate
|
2021-01-02 21:29:21 +01:00
|
|
|
rsync --rsh=ssh -P -rvzc --cvs-exclude --delete $(OUTPUT_DIR)/ $(SSH_USER)@$(SSH_HOST):$(TARGET_DIR)
|
2018-04-29 17:11:44 +02:00
|
|
|
|
2019-04-13 18:58:56 +02:00
|
|
|
# Clean up.
|
2018-04-29 17:11:44 +02:00
|
|
|
clean:
|
|
|
|
rm -rf $(OUTPUT_DIR)
|