bavbavhaus.net/Makefile

26 lines
937 B
Makefile
Raw Normal View History

2024-04-12 22:28:47 +02:00
SHELL = /bin/sh
.SUFFIXES:
2024-05-04 18:55:34 +02:00
# functions for links, pages, and parts, take a list of sources as the only
# argument
getlinks = $(shell pandoc lua pandoc/links.lua $(1))
2024-04-12 22:28:47 +02:00
getpages = $(patsubst %.md,public_html/%.html,$(1))
2024-05-02 20:10:51 +02:00
getparts = $(patsubst %.md,public_html/%.html.part,$(1))
2024-04-12 22:28:47 +02:00
2024-04-22 15:16:39 +02:00
.PHONY: all
2024-05-04 18:55:34 +02:00
all: public_html/index.html $(call getpages,$(call getlinks,--follow index.md))
2024-04-12 22:28:47 +02:00
2024-05-04 19:25:10 +02:00
public_html/index.html: public_html/index.html.part $(call getparts,$(call getlinks,index.md))
2024-05-02 23:53:43 +02:00
.SECONDEXPANSION:
2024-05-04 19:25:10 +02:00
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
2024-04-12 22:28:47 +02:00
2024-05-02 20:10:51 +02:00
public_html/%.html.part: %.md
2024-05-04 18:55:34 +02:00
pandoc --data-dir pandoc -d bavbavhaus.net.part.yaml -M url=$*.html --id-prefix $* -o $@ $<
2024-04-12 22:28:47 +02:00
2024-04-22 15:16:39 +02:00
.PHONY: clean
2024-05-02 20:10:51 +02:00
clean:
$(RM) public_html/*.html.part
$(RM) public_html/*.html