#!/usr/bin/make -f

# DH_VERBOSE := 1

BUILD_DATE=$(shell dpkg-parsechangelog | sed -ne 's/^Date: //p' | LC_ALL=C date -u "+%d %B %Y" -f -)

MANPAGES:=$(wildcard debian/man/*.*.xml)

%:
	dh $@

override_dh_clean:
	dh_clean debian/man/*.1

override_dh_auto_build:
	# Create man pages from DocBook XML
	for x in $(MANPAGES) ; do \
	  docbook2x-man --string-param header-3="$(BUILD_DATE)" $$x ; \
	  mv `basename $$x | sed 's/.xml$$//'` `dirname $$x` ; \
	done

	dh_auto_build

get-orig-source:
	. debian/get-orig-source

