#!/usr/bin/make -f
#

DB2MAN = /usr/share/xml/docbook/stylesheet/docbook-xsl-ns/manpages/docbook.xsl
XP     = xsltproc --nonet --param make.year.ranges 1 --param make.single.year.ranges 1 --param man.charmap.use.subset 0 -o debian/

mpd-sima.1:
	$(XP) $(DB2MAN) data/mpd_sima.1.xml

simadb_cli.1:
	$(XP) $(DB2MAN) data/simadb_cli.1.xml

mpd-sima.cfg.1:
	$(XP) $(DB2MAN) data/mpd_sima.cfg.1.xml

%:
	dh $@ --with bash_completion,python2

override_dh_installchangelogs:
	dh_installchangelogs doc/Changelog

# Upstream does not guarantee to provide or to build latest versions of
# manuals. We build them here to make sure to have proper manuals.
override_dh_installman: mpd-sima.1 simadb_cli.1 mpd-sima.cfg.1
	dh_installman

# Previous version of MPD_sima (< 0.7) did not have any installation script.
# With 0.7 appears a Makefile but I kept using dh to install the source.
# This is why debian/rules overrides upstream Makefile calls (clean, install
# and build)
#
# Prevent calling upstream make targets
override_dh_auto_clean:
override_dh_auto_install:
override_dh_auto_build:
