diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8a23811 --- /dev/null +++ b/Makefile @@ -0,0 +1,62 @@ +.SHELLFLAGS := -eu -o pipefail -c +.ONESHELL: +.DELETE_ON_ERROR: + +PREFIX ?= public + +brotli := brotli --force +gzip := gzip --best --keep --force +zstd := zstd --force --no-pass-through -19 --quiet + +build: + zola build --output-dir $(PREFIX) + +to_compress := $(shell fd . $(PREFIX) --type=file -e html -e xml -e txt -e asc) +brotli_files := $(patsubst %, %.br, $(to_compress)) +gzip_files := $(patsubst %, %.gz, $(to_compress)) +zstd_files := $(patsubst %, %.zst, $(to_compress)) + +${PREFIX}/%.html.br: ${PREFIX}/%.html + $(brotli) $< + +${PREFIX}/%.xml.br: ${PREFIX}/%.xml + $(brotli) $< + +${PREFIX}/%.txt.br: ${PREFIX}/%.txt + $(brotli) $< + +${PREFIX}/%.asc.br: ${PREFIX}/%.asc + $(brotli) $< + +${PREFIX}/%.html.gz: ${PREFIX}/%.html + $(gzip) $< + +${PREFIX}/%.xml.gz: ${PREFIX}/%.xml + $(gzip) $< + +${PREFIX}/%.txt.gz: ${PREFIX}/%.txt + $(gzip) $< + +${PREFIX}/%.asc.gz: ${PREFIX}/%.asc + $(gzip) $< + +${PREFIX}/%.html.zst: ${PREFIX}/%.html + $(zstd) $< + +${PREFIX}/%.xml.zst: ${PREFIX}/%.xml + $(zstd) $< + +${PREFIX}/%.txt.zst: ${PREFIX}/%.txt + $(zstd) $< + +${PREFIX}/%.asc.zst: ${PREFIX}/%.asc + $(zstd) $< + +compress: $(brotli_files) $(gzip_files) $(zstd_files) + +install: compress + +deploy: build compress + rsync --archive --delete public/ pappel.alanpearce.eu:/srv/http/alanpearce.eu + +.PHONY: all build compress install deploy |