SHELL = /bin/sh .SUFFIXES: # functions for links, pages, and parts, take a list of sources as the only # argument getlinks = $(shell pandoc lua pandoc/links.lua $(1)) getpages = $(patsubst %.md,public_html/%.html,$(1)) getparts = $(patsubst %.md,public_html/%.html.part,$(1)) .PHONY: all all: public_html/index.html $(call getpages,$(call getlinks,--follow index.md)) public_html/index.html: public_html/index.html.part $(call getparts,$(call getlinks,index.md)) .SECONDEXPANSION: public_html/%.html: public_html/%.html.part $$(call getparts,$$(call getlinks,%.md)) public_html/index.html.part pandoc --data-dir pandoc -d bavbavhaus.net.yaml -M slug=$* -M bodypart=$< $(patsubst %,-M linkparts=%,$(filter-out $<,$^)) -o $@ $*.md public_html/%.html.part: %.md pandoc --data-dir pandoc -d bavbavhaus.net.part.yaml -M url=$*.html --id-prefix $* -o $@ $< .PHONY: clean clean: $(RM) public_html/*.html.part $(RM) public_html/*.html