SHELL = /bin/sh .SUFFIXES: NOTES = $(shell pandoc lua pandoc/collect_notes.lua index.md) TARGETS = $(patsubst %.md,public_html/%.html,$(NOTES)) GETDEPS = $(patsubst %.md,public_html/%.html.part,$(shell pandoc lua pandoc/collect_links.lua $(1))) DEPSMETAFLAGS = $(patsubst %,-M linkparts=%,$(filter-out $<,$^)) .PHONY: all all: $(TARGETS) .SECONDEXPANSION: public_html/%.html: %.md \ $$(call GETDEPS,%.md) \ public_html/sitemap.html.part pandoc --data-dir pandoc -d bavbavhaus.net.yaml -M slug=$* $(DEPSMETAFLAGS) -o $@ $< public_html/%.html.part: %.md pandoc --data-dir pandoc -d bavbavhaus.net.part.yaml --id-prefix $* -M url=$*.html -M slug=$* -o $@ $< public_html/sitemap.html.part: $(NOTES) pandoc lua pandoc/sitemap.lua index.md $@ dest/%.docx: %.md test -d dest || mkdir dest pandoc --data-dir pandoc --resource-path pandoc -d docx.yaml -o $@ $< .PHONY: clean clean: $(RM) public_html/*.html.part $(RM) public_html/*.html $(RM) -r dest