.PHONY: default cleantmp clean

default: $(subst md,pdf,$(wildcard *.md))

SOURCES=$(wildcard *.asm) $(wildcard *.txt)

%.pdf: %.html
	wkhtmltopdf --title "$* - DJERABA Taky PREUD'HOMME Geoffrey" "$<" "$@"

%.html: %.tmp ../template.html
	pandoc -f markdown+hard_line_breaks "$<" --template ../template.html -o "$@"

%.tmp: %.md $(SOURCES)
	markedpp "$<" > "$@"

cleantmp:
	rm -rf $(subst md,html,$(wildcard *.md)) *.tmp

clean: cleantmp
	rm -rf $(subst md,pdf,$(wildcard *.md))