about summary refs log tree commit diff stats
path: root/Makefile
blob: b5ed0a60f6a0654a942460b0e30c890d64175717 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.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: $(PREFIX)

$(PREFIX):
	zola build --output-dir $(PREFIX)

clean:
	rm -rf ./$(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 clean build compress install deploy