From ee71be14a05d0d7da38352f8ff5c19798f96d4eb Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 8 Apr 2023 13:22:48 -0300 Subject: v2: Generate collections index.html pages and their "by-category" equivalents --- v2/dynamic.mk | 61 +++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 16 deletions(-) (limited to 'v2/dynamic.mk') diff --git a/v2/dynamic.mk b/v2/dynamic.mk index 06d9bbf..9ebd5ef 100644 --- a/v2/dynamic.mk +++ b/v2/dynamic.mk @@ -7,7 +7,7 @@ include generated.mk .SUFFIXES: -.SUFFIXES: .md .content .conf .html .xmlentry +.SUFFIXES: .md .content .conf .html .categoryentry .indexentry .xmlentry .md.content: @@ -19,39 +19,69 @@ include generated.mk .md.html: html $< > $@ +.md.categoryentry: + category $< > $@ + +.md.indexentry: + indexentry $< > $@ + .md.xmlentry: xmlentry $< > $@ -derived-assets = \ - $(all-generated) \ - $(feeds) \ - all: public $(all-generated.conf) $(all-generated.content): $(non-content) -$(all-generated.conf): src/lib/base.conf +$(all-generated.conf): src/lib/base.conf src/lib/generated.conf + +src/lib/generated.conf: src/bin/conf + conf > $@ + +$(all-generated.categories): + categories $@ + +$(all-generated.index): src/lib/generated.conf + index $@ $(all-generated.xml): feed $@ clean: rm -rf \ - public/ $(derived-assets) *.sentinel generated.mk po/po4a.cfg \ - src/content/*/*.html.*.txt src/content/*/*/*.html.*.txt \ - src/content/*/*/*.sortdata src/content/**/feeds/ \ + public/ $(all-generated) *.sentinel generated.mk po/po4a.cfg \ + src/content/*/*.category src/content/*/*/*.category \ + src/content/*/*.categorysort src/content/*/*/*.categorysort \ + src/content/*/*.html src/content/*/*/*.html \ + src/content/*/*.extrahtml src/content/*/*/*.extrahtml \ + src/content/*/*.extrafeeds src/content/*/*/*.extrafeeds \ + src/content/*/*.html.*.txt src/content/*/*/*.html.*.txt \ + src/content/*/*.sortdata src/content/*/*/*.sortdata \ + src/content/*/feed.*.xml src/content/*/*/feed.*.xml \ + src/lib/generated.conf src/lib/generated.*.conf po/*.mo \ -public: $(derived-assets) symlink-mappings.sentinel copy-content.sentinel copy-code-snippets.sentinel +public: symlink-mappings.sentinel copy-content.sentinel copy-containers.sentinel content = \ $(all-generated.html) \ + $(all-generated.index) \ $(all-generated.xml) \ $(static-content) \ -symlink-mappings.sentinel: src/redirect.mappings content-mkdir.sentinel +containers = \ + $(all-generated.snippets) \ + $(all-generated.extrahtml) \ + $(all-generated.extrafeeds) \ + + +symlink-mappings.sentinel: src/redirect.mappings + awk '{print $$2}' src/redirect.mappings | \ + xargs dirname | \ + sort | \ + uniq | \ + xargs -P`nproc` -I% mkdir -p public/% < src/redirect.mappings \ awk '{ printf "ln -rfs public/%s public/%s\n", $$2, $$1 }' | \ sh @@ -62,15 +92,14 @@ copy-content.sentinel: $(content) content-mkdir.sentinel xargs -P`nproc` -I% ln -f src/content/% public/% touch $@ -copy-code-snippets.sentinel: $(all-generated.snippets) content-mkdir.sentinel +copy-containers.sentinel: $(containers) content-mkdir.sentinel echo $? | tr ' ' '\n' | grep '^src/content/' | \ xargs sed 's|^src/content/||' | \ xargs -P`nproc` -I% ln -f src/content/% public/% touch $@ -content-mkdir.sentinel: $(content) $(all-generated.snippets) src/redirect.mappings +content-mkdir.sentinel: $(content) $(containers) echo $? | tr ' ' '\n' | grep '^src/content/' | sed 's|^src/content/||' | \ - printf '%s\n%s\n' "`cat -`" "`awk '{print $$2}' src/redirect.mappings`" | \ xargs dirname | \ sort | \ uniq | \ @@ -78,8 +107,8 @@ content-mkdir.sentinel: $(content) $(all-generated.snippets) src/redirect.mappin touch $@ -src/content/favicon.ico: src/content/favicon.svg - convert src/content/favicon.svg $@ +src/content/favicon.ico: src/content/img/favicon.svg + convert src/content/img/favicon.svg $@ src/content/public.asc.txt: gpg --armour --export '$(EMAIL)' > $@ -- cgit v1.2.3