diff --git a/scripts/Makefile.static b/scripts/Makefile.static index 5f21944..93c20b6 100644 --- a/scripts/Makefile.static +++ b/scripts/Makefile.static @@ -7,11 +7,20 @@ GZ = $(patsubst %,%.gz,$(SRCS)) .PHONY: all all: $(ZSTD) $(BR) $(GZ) -%.br: % - brotli $< +.SECONDARY: -%.zst: % - zstd -19 $< +%.br: %.xxhash + brotli -f $* -%.gz: % - zopfli $< +%.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