bavbavhaus.net/Makefile

39 lines
1.2 KiB
Makefile

.SUFFIXES:
notes := $(wildcard *.md)
pages := $(patsubst %.md,public_html/%.html,$(notes))
parts := $(patsubst %.md,public_html/%.html.part,$(notes))
preqs := $(patsubst %.md,public_html/%.html.d,$(notes))
all: $(pages)
PANDOCFLAGS := --data-dir pandoc
BAVBAVHAUSFLAGS = $(PANDOCFLAGS) -M slug=$*
public_html/%.html: %.md
@echo $(LANG)
pandoc $(BAVBAVHAUSFLAGS) -d bavbavhaus.net.yaml -o $@ $<
public_html/%.html.part: %.md
pandoc $(BAVBAVHAUSFLAGS) -d bavbavhaus.net.part.yaml --id-prefix $* -o $@ $<
public_html/%.html.d: %.md
pandoc lua dependencies.lua $< > $@
include $(preqs)
clean: oldpages := $(filter-out $(pages),$(wildcard public_html/*.html))
clean: oldparts := $(filter-out $(parts),$(wildcard public_html/*.html.part))
clean: oldpreqs := $(filter-out $(preqs),$(wildcard public_html/*.html.d))
clean:
$(if $(oldpages),$(RM) $(filter-out $(pages),$(wildcard public_html/*.html)))
$(if $(oldparts),$(RM) $(filter-out $(parts),$(wildcard public_html/*.html.part)))
$(if $(oldpreqs),$(RM) $(filter-out $(preqs),$(wildcard public_html/*.html.d)))
.PHONY: all clean
dest/%.docx: %.md
test -d dest || mkdir dest
pandoc $(PANDOCFLAGS) -d docx.yaml -o $@ $<