diff --git a/scripts/Makefile.static b/scripts/Makefile.static index 5f21944..99fbac3 100644 --- a/scripts/Makefile.static +++ b/scripts/Makefile.static @@ -7,11 +7,27 @@ GZ = $(patsubst %,%.gz,$(SRCS)) .PHONY: all all: $(ZSTD) $(BR) $(GZ) -%.br: % - brotli $< +define MAKETARGET -%.zst: % - zstd -19 $< +$(1).br: $(1).xxhash + brotli -f $(1) + touch $(1).br -%.gz: % - zopfli $< +$(1).zst: $(1).xxhash + zstd -f -19 $(1) + touch $(1).zst + +$(1).gz: $(1).xxhash + zopfli $(1) + touch $(1).gz + +# https://github.com/gohugoio/hugo/issues/10842 +$(1).xxhash: $(1) + current=$$$$(xxhsum $$< | cut -d' ' -f1); \ + if [ ! -f $$< ] || [ "$$$$(cat $$@ 2>/dev/null)" != "$$$$current" ]; then \ + echo "$$$$current" > $$@; \ + fi + +endef + +$(foreach f,$(SRCS),$(eval $(call MAKETARGET,$(f)))) diff --git a/scripts/build b/scripts/build index b554ec6..7a79feb 100755 --- a/scripts/build +++ b/scripts/build @@ -2,6 +2,6 @@ set -xeuo pipefail cd "$(git rev-parse --show-toplevel)" -hugo --cleanDestinationDir --printPathWarnings --panicOnWarning +hugo --printPathWarnings --panicOnWarning find public -type d | xargs -P4 -n1 make -j4 -sf $PWD/scripts/Makefile.static -C