http: replaces prune_out script with make rules

This commit is contained in:
2026-06-25 08:22:27 +01:00
parent aa4f63a8ce
commit 83e0f1cda5
2 changed files with 16 additions and 36 deletions
+16 -4
View File
@@ -18,6 +18,8 @@ out_deps := $(addprefix out/,$(src_files:src/%=%))
remove_layout_from_out_deps = out_deps := $$(subst $(1).upp,.,$$(out_deps))
$(foreach layout,$(layouts),$(eval $(call remove_layout_from_out_deps,.$(layout))))
$(eval $(call remove_layout_from_out_deps,))
out_deps_without_src := $(filter-out $(out_deps),$(shell find -L out -type f))
out_deps += $(out_deps_without_src)
blogs := $(subst blogs/,,$(wildcard blogs/*))
@@ -61,6 +63,18 @@ $(blog_post_target): $(blog_post_src) $(let ext,html,$(layout_file) $(component_
-f $$*.$(BLOG_EXT_$(blog))
endef
define prune_out_file_rule =
$(let orig_ext,$(patsubst .%,%,$(suffix $(file))),
$(let ext,$(patsubst upp%,%,$(orig_ext)),
$(let rel_basename,$(patsubst out/%.$(orig_ext),%,$(file)),
$(let src_file,src/$(rel_basename).upp$(ext),
$(let src_files_with_layouts,$(foreach layout,$(layouts),src/$(rel_basename).$(layout).upp$(ext)),
$(let public_file,public/$(rel_basename).$(orig_ext),
$(src_file) $(src_files_with_layouts) $(public_file):
rm $(file)
))))))
endef
define prune_blog_rule =
.PHONY: prune_$(blog)
prune_$(blog):
@@ -106,11 +120,9 @@ out/%: public/%
mkdir -p $(dir $@) && cp $< $@
.PHONY: prune
prune: $(addprefix prune_,$(blogs)) prune_out
prune: $(addprefix prune_,$(blogs))
.PHONY: prune_out
prune_out:
./bin/prune_out
$(foreach file,$(out_deps_without_src),$(eval $(prune_out_file_rule)))
$(foreach blog,$(blogs),$(eval $(prune_blog_rule)))