From: cat æscling Date: Fri, 27 Feb 2026 10:28:43 +0000 (-0500) Subject: build: cleanup; use typical conventions X-Git-Url: https://awoo.directory/?a=commitdiff_plain;p=blog.git build: cleanup; use typical conventions build in build, not temp. update templates to match --- diff --git a/Makefile b/Makefile index f13c31c..322d05e 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,10 @@ OUTDIR=blog.aescling.cat.family +BUILDDIR=build ARTICLES=$(wildcard source/*.djot) _UNFORMATTED_ARTICLES=$(ARTICLES:.djot=.unformatted) -UNFORMATTED_ARTICLES=$(patsubst source/%, temp/%, $(_UNFORMATTED_ARTICLES)) -_FORMATTED_ARTICLES=$(UNFORMATTED_ARTICLES:.unformatted=.xhtml) -# putting these in $(OUTDIR) will make the links from index.xhtml point to -# `4(OUTDIR)/$BASENAME.xhtml`, instead of `$BASENAME.xhtml`; we will move them -# later -FORMATTED_ARTICLES=$(patsubst temp/%, %, $(_FORMATTED_ARTICLES)) +UNFORMATTED_ARTICLES=$(patsubst source/%, $(OUTDIR)/%, $(_UNFORMATTED_ARTICLES)) +FORMATTED_ARTICLES=$(UNFORMATTED_ARTICLES:.unformatted=.xhtml) COMMONS=$(wildcard template/common/*) @@ -15,20 +12,19 @@ COMMONS=$(wildcard template/common/*) .SECONDARY: all: $(OUTDIR)/index.xhtml $(OUTDIR)/atom.xml - for f in $(FORMATTED_ARTICLES); do \ - [ -f "$$f" ] || exit 0; \ - done && mv $(FORMATTED_ARTICLES) $(OUTDIR) -$(OUTDIR)/index.xhtml: temp/index.unformatted_index +$(OUTDIR)/index.xhtml: $(BUILDDIR)/index.unformatted_index $(OUTDIR) hxnormalize -x $< >$@ -temp/index.unformatted_index: $(FORMATTED_ARTICLES) template/index.xhtml.template +$(BUILDDIR)/index.unformatted_index: $(FORMATTED_ARTICLES) template/index.xhtml.template $(BUILDDIR) sblg -t template/index.xhtml.template -s rdate -o $@ $(FORMATTED_ARTICLES) -%.xhtml: temp/%.unformatted +# the URLs fur post will be `$(OUTDIR)/%.xhtml`; links will havu to be +# overridden in the templates +$(OUTDIR)%.xhtml: $(BUILDDIR)/%.unformatted $(BUILDDIR) hxnormalize -x $< >$@ -temp/%.unformatted: temp/%.fragment template/article.xhtml.template +$(BUILDDIR)/%.unformatted: $(BUILDDIR)/%.fragment template/article.xhtml.template $(BUILDDIR) sblg -t template/article.xhtml.template -c -o $@ $< # the djot file MUST generate content surrounded by @@ -43,20 +39,26 @@ temp/%.unformatted: temp/%.fragment template/article.xhtml.template # # the hxextract(1) invocation is redundant unless the djot source file is # pathological, containing content befur or after the div -temp/%.fragment: source/%.djot +$(BUILDDIR)/%.fragment: source/%.djot { echo '
'; \ djot $< | hxextract .article - | sed '1d; $$d'; \ echo '
'; } >$@ -$(OUTDIR)/atom.xml: temp/atom.unformatted_atom +$(OUTDIR)/atom.xml: $(BUILDDIR)/atom.unformatted_atom $(OUTDIR) hxnormalize -x $< >$@ -temp/atom.unformatted_atom: $(FORMATTED_ARTICLES) template/atom.xml.template +$(BUILDDIR)/atom.unformatted_atom: $(FORMATTED_ARTICLES) template/atom.xml.template $(BUILDDIR) sblg -t template/atom.xml.template -a -o $@ $(FORMATTED_ARTICLES) template/%.template: template/%.sh $(COMMONS) ./$< | hxnormalize -x >$@ +$(OUTDIR): + mkdir -p $(OUTDIR) + +$(BUILDDIR): + mkdir -p $(BUILDDIR) + clean: - rm temp/* + rm $(BUILDDIR)/* rm $(OUTDIR)/* diff --git a/blog.aescling.cat.family/.gitkeep b/blog.aescling.cat.family/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/temp/.gitkeep b/temp/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/template/index.xhtml.sh b/template/index.xhtml.sh index 3dc92f7..43561e4 100755 --- a/template/index.xhtml.sh +++ b/template/index.xhtml.sh @@ -16,7 +16,8 @@ cat <<'EOF'

a blog by cat æscling

- + EOF cat template/common/footer.xhtml.template.fragment