39 lines
956 B
Makefile
39 lines
956 B
Makefile
SHELL = /bin/sh
|
|
.SUFFIXES:
|
|
|
|
# functions for pages, and parts, takes a list of sources as the only argument
|
|
getpages = $(patsubst %.md,public_html/%.html,$(1))
|
|
getparts = $(patsubst %.md,public_html/%.html.part,$(1))
|
|
|
|
all: $(call getpages,$(shell pandoc lua pandoc/links.lua --follow index.md))
|
|
.PHONY: all
|
|
|
|
public_html/%.html: %.md
|
|
$(eval links := $(shell pandoc lua pandoc/links.lua $<))
|
|
$(if $(links),$(MAKE) $(call getparts,$(links)))
|
|
pandoc \
|
|
--data-dir pandoc \
|
|
--defaults bavbavhaus.net.yaml \
|
|
--template bavbavhaus.net.html5 \
|
|
--metadata url=$*.html \
|
|
$(patsubst %,--metadata links=%,$(filter-out $<,$^)) \
|
|
--output $@ \
|
|
$<
|
|
|
|
public_html/%.html.part: %.md
|
|
pandoc \
|
|
--data-dir pandoc \
|
|
--defaults bavbavhaus.net.yaml \
|
|
--template bavbavhaus.net.inline.html5 \
|
|
--id-prefix $* \
|
|
--metadata url=$*.html \
|
|
--output $@ \
|
|
$<
|
|
|
|
|
|
# clean all targets
|
|
.PHONY: clean
|
|
clean:
|
|
$(RM) public_html/*.html.part
|
|
$(RM) public_html/*.html
|