makefile cleanup

This commit is contained in:
Never Gude 2026-01-04 21:46:30 +01:00
parent 6f9d0bb821
commit c22214b665
5 changed files with 4 additions and 192 deletions

View file

@ -17,7 +17,7 @@ article_list := articles.json
# article targets
articles := $(patsubst %.md,%.html,$(wildcard articles/*.md))
all: index.html about.html
all: clean index.html about.html
install:
cp -r index.html about.html $(articles) $(style) $(images) $(INSTALLDIR); \
@ -30,17 +30,12 @@ $(articles): %.html: %.md
# Build articles using pandoc
pandoc $< --template $(template) --css $(style) --highlight-style zenburn --mathml --toc --output $@; \
# Extract metadata from .md file
# pandoc $< --template $(list_template) > article.json.tmp.0; \
# Append filename field to article object. This is used to link to the article from index.html.
# pandoc $< --template $(list_template) | jq '. += {"filename": "$(notdir $@)"}' > article.json.tmp; \
# Append article object to the article list
# Extract metadata from .md file, append filename field to the article object.
# This is used to link to the article from index.html. Append article object to the article list.
jq '.articles += [$(shell pandoc $< --template $(list_template) | jq '. += {"filename": "$(notdir $@)"}' )]' $(article_list) > articles.json.tmp; \
mv ./articles.json.tmp $(article_list); \
index.html: index.md $(articles)
index.html: index.md $(articles)
# Build index.html with metadata injected from articles_list
pandoc $< --template $(template) --css $(style) --metadata-file $(article_list) --highlight-style zenburn --mathml --toc --output $@; \