summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2023-07-08 20:17:24 +0200
committerAlan Pearce2023-07-08 20:17:24 +0200
commit5c20728ac9ca856218436c5cffb75727c8d9cb49 (patch)
tree6a4dbd9e770133d6df1df7391416989e183925ec
parent099c92b74c4f24dfc85ff757b6e284e17eaf8d6d (diff)
downloadwebsite-5c20728ac9ca856218436c5cffb75727c8d9cb49.tar.lz
website-5c20728ac9ca856218436c5cffb75727c8d9cb49.tar.zst
website-5c20728ac9ca856218436c5cffb75727c8d9cb49.zip
Make: avoid re-running format/compress targets
-rw-r--r--.gitignore1
-rw-r--r--Makefile23
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