From 5c20728ac9ca856218436c5cffb75727c8d9cb49 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 8 Jul 2023 20:17:24 +0200 Subject: Make: avoid re-running format/compress targets --- .gitignore | 1 + Makefile | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 81ff1e0..4153053 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /public /.deploystamp +/.formatstamp .direnv /result diff --git a/Makefile b/Makefile index e9c0c4a..2db4b6a 100644 --- a/Makefile +++ b/Makefile @@ -4,17 +4,20 @@ PREFIX ?= public -brotli := brotli --force +brotli := brotli --force --no-copy-stat gzip := gzip --best --keep --force -zstd := zstd --force --no-pass-through -19 --quiet +zstd := zstd --force --no-pass-through -19 --quiet --stdout build: $(PREFIX)/index.html $(PREFIX)/index.html: config.toml content/**.md static/** templates/** themes/**/* zola build --force --output-dir $(PREFIX) -format: $(PREFIX) +format: .formatstamp + +.formatstamp: $(PREFIX)/index.html prettier --write --parser html --print-width 200 "$(PREFIX)/**/*.html" + @touch .formatstamp clean: rm -rf ./$(PREFIX) @@ -49,18 +52,18 @@ ${PREFIX}/%.asc.gz: ${PREFIX}/%.asc $(gzip) $< ${PREFIX}/%.html.zst: ${PREFIX}/%.html - $(zstd) $< + $(zstd) $< > $@ ${PREFIX}/%.xml.zst: ${PREFIX}/%.xml - $(zstd) $< + $(zstd) $< > $@ ${PREFIX}/%.txt.zst: ${PREFIX}/%.txt - $(zstd) $< + $(zstd) $< > $@ ${PREFIX}/%.asc.zst: ${PREFIX}/%.asc - $(zstd) $< + $(zstd) $< > $@ -compress: $(brotli_files) $(gzip_files) $(zstd_files) +compress: .formatstamp $(brotli_files) $(gzip_files) $(zstd_files) install: compress @@ -68,6 +71,6 @@ deploy: .deploystamp .deploystamp: build format compress fly deploy - touch .deploystamp + @touch .deploystamp -.PHONY: all clean build format compress install deploy +.PHONY: all clean build install deploy -- cgit 1.4.1