bavbavhaus.net/Makefile

25 lines
814 B
Makefile

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))
.SECONDEXPANSION:
public_html/%.html: public_html/%.html.part $$(call getparts,$$(call getlinks,%.md))
pandoc --data-dir pandoc -d bavbavhaus.net.yaml -M bodypart=$< $(patsubst %,-M linkparts=%,$(filter-out $<,$^)) -o $@ $*.md
.SECONDARY:
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