XSL=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns/manpages/docbook.xsl
HXSL=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns/html/docbook.xsl
XP=/usr/bin/xsltproc
OPTIONS=--nonet\
   --param make.year.ranges 1\
   --param make.single.year.ranges 1 \
   --param man.charmap.use.subset 0 \

all: man

simadb_cli: simadb_cli.1.xml
	$(XP) $(OPTIONS) $(XSL) $<

mpd_sima: mpd_sima.1.xml
	$(XP) $(OPTIONS) $(XSL) $<

mpd_sima.cfg: mpd_sima.cfg.1.xml
	$(XP) $(OPTIONS) $(XSL) $<

mpd_sima_html:
	$(XP) $(HXSL) mpd_sima.1.xml > ./mpd_sima.1.html

simadb_cli_html:
	$(XP) $(HXSL) simadb_cli.1.xml > ./simadb_cli.1.html

mpd_sima.cfg_html:
	$(XP) $(HXSL) mpd_sima.cfg.1.xml > ./mpd_sima.cfg.1.html

man: simadb_cli mpd_sima mpd_sima.cfg

html: simadb_cli_html mpd_sima_html mpd_sima.cfg_html

pdf: man
	/usr/bin/man -l -Tps mpd-sima.1 | /usr/bin/ps2pdf - ./mpd_sima.pdf
	/usr/bin/man -l -Tps mpd-sima.cfg.1 | /usr/bin/ps2pdf - ./mpd_sima.cfg.pdf
	/usr/bin/man -l -Tps simadb_cli.1 | /usr/bin/ps2pdf - ./simadb_cli.pdf

