summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-06-17 09:23:42 +0100
committerJoe Carstairs <me@joeac.net>2026-06-17 09:23:42 +0100
commit722a3040237736bb262f7b9e05643eb3bfb21bda (patch)
treed9d67c3408cfdc627569fb68604049594599a7bd
parent423fa1ed263d8ea64cf1ea96db60d0942c1a4147 (diff)
factors out prune_out to bin
-rw-r--r--http/Makefile27
-rwxr-xr-xhttp/bin/prune_out32
2 files changed, 33 insertions, 26 deletions
diff --git a/http/Makefile b/http/Makefile
index 1a2b1bf..da2a8d6 100644
--- a/http/Makefile
+++ b/http/Makefile
@@ -3,34 +3,9 @@ all: microlog blog public out
.PHONY: prune
prune: prune_microlog prune_blog prune_out
-.SILENT: prune_out
.PHONY: prune_out
prune_out:
- for out in $$(find out -type f); do \
- out_basename="$$(basename "$$out")"; \
- out_ext="$${out_basename##*\.}"; \
- rel_path="$$(echo "$${out}" | cut -c5-)"; \
- if [ -f "public/$${rel_path}" ]; then \
- continue 2; \
- fi; \
- base_rel_path="$${rel_path%%.$${out_ext}}"; \
- src_path="src/$${base_rel_path}.upp$${out_ext}"; \
- if [ -f "$$src_path" ]; then \
- continue 2; \
- fi; \
- for layout in $$(find share/layouts -name "*.layout.upp$${out_ext}"); do \
- layout="$$(basename "$$layout")"; \
- layout="$${layout::$${#layout}-15}"; \
- rel_path="$$(echo "$${out}" | cut -c5-)"; \
- base_rel_path="$${rel_path%%.$${out_ext}}"; \
- src_path="src/$${base_rel_path}.$${layout}.upp$${out_ext}"; \
- if [ -f "$$src_path" ]; then \
- continue 2; \
- fi; \
- done; \
- echo "No source file found to match $${out}: removing it"; \
- rm "$$out"; \
- done
+ ./bin/prune_out
.SILENT: prune_microlog
.PHONY: prune_microlog
diff --git a/http/bin/prune_out b/http/bin/prune_out
new file mode 100755
index 0000000..1670ffd
--- /dev/null
+++ b/http/bin/prune_out
@@ -0,0 +1,32 @@
+#!/bin/sh -e
+
+for out in $(find out -type f)
+do
+ out_basename="$(basename "$out")"
+ out_ext="${out_basename##*\.}"
+ rel_path="$(echo "${out}" | cut -c5-)"
+
+ if [ -f "public/${rel_path}" ]; then
+ continue 2
+ fi
+
+ base_rel_path="${rel_path%%.${out_ext}}"
+ src_path="src/${base_rel_path}.upp${out_ext}"
+ if [ -f "$src_path" ]; then
+ continue 2
+ fi
+
+ for layout in $(find share/layouts -name "*.layout.upp${out_ext}"); do
+ layout="$(basename "$layout")"
+ layout="${layout::${#layout}-15}"
+ rel_path="$(echo "${out}" | cut -c5-)"
+ base_rel_path="${rel_path%%.${out_ext}}"
+ src_path="src/${base_rel_path}.${layout}.upp${out_ext}"
+ if [ -f "$src_path" ]; then
+ continue 2
+ fi
+ done
+
+ echo "No source file found to match ${out}: removing it"
+ rm "$out"
+done