summary refs log tree commit diff stats
path: root/Makefile
blob: 17c7548839287d60eb03c4fd1ffdcf26ac0f1962 (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
.SHELLFLAGS := -eu -o pipefail -c
.ONESHELL:
.DELETE_ON_ERROR:

brotli := brotli --force
gzip := gzip --best --keep --force
zstd := zstd --force --no-pass-through -19 --quiet

build:
	zola build

to_compress := $(shell fd . public --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))

public/%.html.br: public/%.html
	$(brotli) $<

public/%.xml.br: public/%.xml
	$(brotli) $<

public/%.txt.br: public/%.txt
	$(brotli) $<

public/%.asc.br: public/%.asc
	$(brotli) $<

public/%.html.gz: public/%.html
	$(gzip) $<

public/%.xml.gz: public/%.xml
	$(gzip) $<

public/%.txt.gz: public/%.txt
	$(gzip) $<

public/%.asc.gz: public/%.asc
	$(gzip) $<

public/%.html.zst: public/%.html
	$(zstd) $<

public/%.xml.zst: public/%.xml
	$(zstd) $<

public/%.txt.zst: public/%.txt
	$(zstd) $<

public/%.asc.zst: public/%.asc
	$(zstd) $<

compress: $(brotli_files) $(gzip_files) $(zstd_files)

.PHONY: all build compress