]> cat aescling's git repositories - blog.git/commitdiff
build: cleanup; use typical conventions main
authorcat æscling <aescling@cat.family>
Fri, 27 Feb 2026 10:28:43 +0000 (05:28 -0500)
committercat æscling <aescling@cat.family>
Fri, 27 Feb 2026 10:28:43 +0000 (05:28 -0500)
build in build, not temp. update templates to match

Makefile
blog.aescling.cat.family/.gitkeep [deleted file]
temp/.gitkeep [deleted file]
template/index.xhtml.sh

index f13c31c3584755d36db567c49eebd24bd7d49c80..322d05ee1d4b8ffd468ea8beed4bd83ef3177b69 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,10 @@
 OUTDIR=blog.aescling.cat.family
 OUTDIR=blog.aescling.cat.family
+BUILDDIR=build
 
 ARTICLES=$(wildcard source/*.djot)
 _UNFORMATTED_ARTICLES=$(ARTICLES:.djot=.unformatted)
 
 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/*)
 
 
 COMMONS=$(wildcard template/common/*)
 
@@ -15,20 +12,19 @@ COMMONS=$(wildcard template/common/*)
 .SECONDARY:
 
 all: $(OUTDIR)/index.xhtml $(OUTDIR)/atom.xml
 .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 $< >$@
 
        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)
 
        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 $< >$@
 
        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
        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
 #
 # 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 '<article data-sblg-article="1">'; \
                djot $< | hxextract .article - | sed '1d; $$d'; \
                echo '</article>'; } >$@
 
        { echo '<article data-sblg-article="1">'; \
                djot $< | hxextract .article - | sed '1d; $$d'; \
                echo '</article>'; } >$@
 
-$(OUTDIR)/atom.xml: temp/atom.unformatted_atom
+$(OUTDIR)/atom.xml: $(BUILDDIR)/atom.unformatted_atom $(OUTDIR)
        hxnormalize -x $< >$@
 
        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 >$@
 
        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:
 clean:
-       rm temp/*
+       rm $(BUILDDIR)/*
        rm $(OUTDIR)/*
        rm $(OUTDIR)/*
diff --git a/blog.aescling.cat.family/.gitkeep b/blog.aescling.cat.family/.gitkeep
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/temp/.gitkeep b/temp/.gitkeep
deleted file mode 100644 (file)
index e69de29..0000000
index 3dc92f764d60f7ffb6ab508a3893394322067b5f..43561e4340066ab2f74bd52ef05dab0a999d03b5 100755 (executable)
@@ -16,7 +16,8 @@ cat <<'EOF'
       <p>a blog by cat æscling</p>
     </header>
 
       <p>a blog by cat æscling</p>
     </header>
 
-    <nav data-sblg-nav="1"></nav>
+    <nav data-sblg-nav="1" data-sblg-navcontent="1">${sblg-date}: <a href="${sblg-stripbase}.xhtml">${sblg-title}</a>
+    </nav>
 EOF
 
 cat template/common/footer.xhtml.template.fragment
 EOF
 
 cat template/common/footer.xhtml.template.fragment