-man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
- @test -n "$(DOCBOOK2MAN)" || \
- { echo 'docbook2man' not found during configure; exit 1; }
- $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
+man/footer.man: man/footer.rst
+ @test -n "$(PANDOC)" || \
+ { echo 'pandoc' not found during configure; exit 1; }
+ $(PANDOC) -f rst -t man -o $@ $<
+
+man/footer.html: man/footer.rst
+ @test -n "$(PANDOC)" || \
+ { echo 'pandoc' not found during configure; exit 1; }
+ $(PANDOC) -f rst -t html -o $@ $<
+
+man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
+ PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
+
+man/%.7.in man/%.8.in: man/%.gen man/footer.man
+ @test -n "$(PANDOC)" || \
+ { echo 'pandoc' not found during configure; exit 1; }
+ set -o pipefail ; \
+ $(PANDOC) -s -f rst -t man -A man/footer.man $< | \
+ sed -e 's/\\@/@/g' > $@