Improved Makefile

This commit is contained in:
Raoul 2019-04-13 18:58:56 +02:00
parent d56359de2b
commit 8da3860bda
No known key found for this signature in database
GPG key ID: C7493D73B67C1842

View file

@ -1,22 +1,40 @@
OUTPUT_DIR = public
# Hugo configuration.
HUGO_COMMAND := hugo
HUGO_OPTIONS := --i18n-warnings
SSH_HOST = www.cosin.ch
SSH_USER = root
TARGET_DIR = /srv/www/www.cosin.ch/
OUTPUT_DIR := public
HUGO_FLAGS = --i18n-warnings
# Vnu validator configuration.
VNU_COMMAND := vnu
VNU_OPTIONS := --skip-non-html --also-check-css
.PHONY: generate server upload clean
# Rsync deployment configuration.
SSH_HOST := www.cosin.ch
SSH_USER := root
TARGET_DIR := /srv/www/www.cosin.ch/
# Non-file goals.
.PHONY: server generate validate upload clean
generate:
hugo $(HUGO_FLAGS)
# Include the configuration files.
-include config.mk settings.mk
# Start a local development server.
server:
hugo $(HUGO_FLAGS) server
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)
# Deploy the website to the production webserver.
upload: generate
rsync -P -rvzc --delete --include=*/fahrplan/ --exclude=fahrplan/ $(OUTPUT_DIR)/ $(SSH_USER)@$(SSH_HOST):$(TARGET_DIR)
rsync --rsh=ssh -P -rvzc --cvs-exclude --delete --include=*/fahrplan/ --exclude=fahrplan/ $(OUTPUT_DIR)/ $(SSH_USER)@$(SSH_HOST):$(TARGET_DIR)
# Clean up.
clean:
rm -rf $(OUTPUT_DIR)