factors out prune_out to bin
This commit is contained in:
+1
-26
@@ -3,34 +3,9 @@ all: microlog blog public out
|
|||||||
.PHONY: prune
|
.PHONY: prune
|
||||||
prune: prune_microlog prune_blog prune_out
|
prune: prune_microlog prune_blog prune_out
|
||||||
|
|
||||||
.SILENT: prune_out
|
|
||||||
.PHONY: prune_out
|
.PHONY: prune_out
|
||||||
prune_out:
|
prune_out:
|
||||||
for out in $$(find out -type f); do \
|
./bin/prune_out
|
||||||
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
|
|
||||||
|
|
||||||
.SILENT: prune_microlog
|
.SILENT: prune_microlog
|
||||||
.PHONY: prune_microlog
|
.PHONY: prune_microlog
|
||||||
|
|||||||
Executable
+32
@@ -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
|
||||||
Reference in New Issue
Block a user