SRCS = $(wildcard *.html *.xml *.txt *.css *.map *.pdf) ZSTD = $(patsubst %,%.zst,$(SRCS)) BR = $(patsubst %,%.br,$(SRCS)) GZ = $(patsubst %,%.gz,$(SRCS)) .PHONY: all all: $(ZSTD) $(BR) $(GZ) .SECONDARY: %.br: %.xxhash brotli -f $* %.zst: %.xxhash zstd -f -19 $* %.gz: %.xxhash zopfli $* # https://github.com/gohugoio/hugo/issues/10842 %.xxhash: % current=$$(xxhsum $< | cut -d' ' -f1); \ if [ ! -f $< ] || [ "$$(cat $@ 2>/dev/null)" != "$$current" ]; then \ echo "$$current" > $@; \ fi