#!/usr/bin/make -f

# dependencies:

# apt install weasyprint xml2rfc ruby-kramdown-rfc2629

draft = sop
OUTPUT = $(draft).txt $(draft).html $(draft).xml $(draft).pdf
INCLUSIONS = sop.h test/simple-sop-test test/setup-sopv-test test/sopv-test

all: $(OUTPUT)

%.xml: $(draft).md $(INCLUSIONS)
	kramdown-rfc --v3 < $< > $@.tmp
	mv $@.tmp $@

%.html: %.xml
	xml2rfc $< --html -o $@

%.txt: %.xml
	xml2rfc $< --text -o $@

%.pdf: %.xml
	xml2rfc $< --pdf -o $@

clean:
	-rm -rf $(OUTPUT) manpages/*.1 .refcache metadata.min.js

check:
	codespell --ignore-words .ignore-words $(draft).md
.PHONY: clean all check
