bavbavhaus.net/Makefile

38 lines
1.2 KiB
Makefile
Raw Normal View History

2024-04-12 22:28:47 +02:00
SHELL = /bin/sh
.SUFFIXES:
2024-05-17 15:35:32 +02:00
# All notes referenced with internal links, starting from `index.md`.
2024-05-16 23:05:10 +02:00
NOTES = $(shell pandoc lua pandoc/collect_notes.lua index.md)
2024-05-17 15:35:32 +02:00
# All pages referenced with internal links, starting from `index.md`.
PAGES := $(patsubst %.md,public_html/%.html,$(NOTES))
# All parts referenced with internal links in `$(1)`, plus the sitemap.
PARTS = $(patsubst %.md,public_html/%.html.part,$(shell pandoc lua pandoc/collect_links.lua $(1))) public_html/sitemap.html.part
PANDOCFLAGS = --data-dir pandoc
2024-04-12 22:28:47 +02:00
2024-04-22 15:16:39 +02:00
.PHONY: all
2024-05-17 15:35:32 +02:00
all: $(PAGES)
2024-05-04 19:25:10 +02:00
2024-05-02 23:53:43 +02:00
.SECONDEXPANSION:
2024-05-17 15:35:32 +02:00
public_html/%.html: flags = $(patsubst %,-M parts=%,$(filter-out $<,$^))
public_html/%.html: %.md $$(call PARTS,%.md)
@echo $^
pandoc $(PANDOCFLAGS) -d bavbavhaus.net.yaml -M slug=$* $(flags) -o $@ $<
2024-04-12 22:28:47 +02:00
2024-05-17 15:35:32 +02:00
.SECONDARY:
2024-05-02 20:10:51 +02:00
public_html/%.html.part: %.md
2024-05-17 15:35:32 +02:00
pandoc $(PANDOCFLAGS) -d bavbavhaus.net.part.yaml --id-prefix $* -M url=$*.html -M slug=$* -o $@ $<
2024-05-16 23:05:10 +02:00
public_html/sitemap.html.part: $(NOTES)
pandoc lua pandoc/sitemap.lua index.md $@
dest/%.docx: %.md
test -d dest || mkdir dest
pandoc --data-dir pandoc --resource-path pandoc -d docx.yaml -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
2024-05-16 23:05:10 +02:00
$(RM) -r dest