bavbavhaus.net/Makefile

39 lines
956 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-05-02 20:10:51 +02:00
all: $(call getpages,$(shell pandoc lua pandoc/links.lua --follow index.md))
2024-04-22 15:16:39 +02:00
.PHONY: all
2024-04-12 22:28:47 +02:00
2024-05-02 20:10:51 +02:00
public_html/%.html: %.md
$(eval links := $(shell pandoc lua pandoc/links.lua $<))
$(if $(links),$(MAKE) $(call getparts,$(links)))
2024-04-12 22:28:47 +02:00
pandoc \
--data-dir pandoc \
--defaults bavbavhaus.net.yaml \
--template bavbavhaus.net.html5 \
2024-05-02 20:10:51 +02:00
--metadata url=$*.html \
$(patsubst %,--metadata links=%,$(filter-out $<,$^)) \
2024-04-12 22:28:47 +02:00
--output $@ \
$<
2024-05-02 20:10:51 +02:00
public_html/%.html.part: %.md
2024-04-12 22:28:47 +02:00
pandoc \
--data-dir pandoc \
--defaults bavbavhaus.net.yaml \
--template bavbavhaus.net.inline.html5 \
2024-05-02 20:10:51 +02:00
--id-prefix $* \
--metadata url=$*.html \
2024-04-12 22:28:47 +02:00
--output $@ \
$<
# clean all targets
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