bavbavhaus.net/Makefile

24 lines
897 B
Makefile
Raw Normal View History

2024-04-12 22:28:47 +02:00
SHELL = /bin/sh
.SUFFIXES:
2024-05-02 20:10:51 +02:00
# functions for pages, and parts, takes a list of sources as the only argument
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-02 21:43:58 +02:00
all: public_html/index.html $(call getpages,$(shell pandoc lua pandoc/links.lua --follow index.md))
2024-04-12 22:28:47 +02:00
2024-05-02 23:53:43 +02:00
.SECONDEXPANSION:
public_html/%.html: %.md $$(shell pandoc lua pandoc/links.lua %.md)
$(eval links := $(filter-out $<,$^))
2024-05-02 20:10:51 +02:00
$(if $(links),$(MAKE) $(call getparts,$(links)))
2024-05-02 23:53:43 +02:00
pandoc --data-dir pandoc -d bavbavhaus.net.yaml --template bavbavhaus.net.html5 -M url=$*.html $(patsubst %,-M links=%,$(call getparts,$(links))) -o $@ $<
2024-04-12 22:28:47 +02:00
2024-05-02 20:10:51 +02:00
public_html/%.html.part: %.md
2024-05-02 23:53:43 +02:00
pandoc --data-dir pandoc -d bavbavhaus.net.yaml --template bavbavhaus.net.inline.html5 -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