+AD_PDF=$(TXT_FILES:.txt=.pdf)
+
+SVG=\
+ easymini.svg \
+ telemega.svg \
+ telemetrum.svg \
+ telemini.svg \
+ easymega.svg
+
+RELNOTES_XSL=$(RELNOTES:.html=.xsl)
+HTML=altusmetrum.html altos.html telemetry.html companion.html micropeak.html telegps.html $(RELNOTES)
+PDF=altusmetrum.pdf altos.pdf telemetry.pdf companion.pdf micropeak.pdf telegps.pdf \
+ telemetrum-outline.pdf telemega-outline.pdf easymini-outline.pdf easymega-outline.pdf $(AD_PDF)
+HTMLSTYLE=/usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl
+FOSTYLE=xorg-fo.xsl
+FOPCFG=fop-cfg.xml
+TEMPLATES=titlepage.templates.xsl
+PDFSTYLE=
+IMAGES=$(PICTURES) $(SVG)
+DOC=$(HTML) $(PDF) $(IMAGES)
+
+.SUFFIXES: .inc .txt .raw .pdf .html
+
+XSLTFLAGS=--stringparam section.autolabel 1 --xinclude
+
+.txt.raw:
+ sed -e 's/@@VERSION@@/$(VERSION)/' -e 's/@@DATE@@/$(DATE)/' -e 's/^[ ]*//' -e 's/^\\//' $*.txt > $@
+
+.inc.raw:
+ sed -e 's/@@VERSION@@/$(VERSION)/' -e 's/@@DATE@@/$(DATE)/' -e 's/^[ ]*//' -e 's/^\\//' $*.inc > $@
+
+.raw.pdf:
+ a2x --verbose -k -d book -a docinfo -f pdf --xsltproc-opts "--stringparam toc.section.depth 2" --xsl-file am-fo.xsl --fop --fop-opts="-c fop.xconf" $*.raw
+
+.raw.html:
+ a2x --verbose -k -d book -a docinfo -f xhtml --xsltproc-opts "--stringparam toc.section.depth 2" --stylesheet=am.css $*.raw
+
+.xsl.html:
+ xsltproc $(XSLTFLAGS) -o $@ $(HTMLSTYLE) $*.xsl
+
+.xsl.pdf:
+ xmlto -p '-c $(FOPCFG)' --searchpath `pwd` -x $(FOSTYLE) --with-fop pdf $*.xsl
+
+.xml.xsl:
+ xsltproc --output $@ /usr/share/xml/docbook/stylesheet/docbook-xsl/template/titlepage.xsl $*.xml
+
+all: $(HTML) $(PDF)
+
+altusmetrum.pdf: altusmetrum-docinfo.xml $(RAW_FILES) $(RAW_INC)
+
+install: all
+
+publish: $(DOC)
+ cp $(DOC) /home/bdale/web/altusmetrum/AltOS/doc/
+ (cd /home/bdale/web/altusmetrum ; \
+ git add /home/bdale/web/altusmetrum/AltOS/doc/* ; \
+ echo "update docs" | \
+ git commit -F - /home/bdale/web/altusmetrum/AltOS/doc/* ; \
+ git push)