INPUTS = index.md concepts.md reference.md security.md migration.md whats_new.md
all: $(INPUTS:.md=.html)
tmp_menu.html: $(INPUTS)
	echo '
' > $@
	(echo '
Documentation index
'; \
	 for file in $^; do echo -n '1. ['; sed -n '1 s!^# Nanopb: !! p' $$file; \
	 echo -n "]("; echo $$file | sed 's/.md/.html)/' ; done;) | \
	 pandoc -f markdown -t html5 >> $@
	echo '' >> $@
%.html: %.md tmp_menu.html
	sed '1 s!#!%!' $< | \
	pandoc -s -f markdown -t html5 -c lsr.css --toc --toc-depth=4 \
	 --variable 'header-includes=' \
	 --indented-code-classes=c \
	 -o $@
	sed -i '/