#!/usr/bin/make -f
# -*- makefile -*-
export DH_OPTIONS
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
VERSION = $(shell grep LinthesiaVersionString src/Version.h | cut -f 6 -d " " | tr -d \"\;)

%:
	dh  $@

override_dh_auto_build: debian/linthesia.6
	$(MAKE) GRAPHDIR=/usr/share/linthesia/graphics

debian/linthesia.6:
	xsltproc -o $@ --param man.charmap.use.subset "0" --novalid --nonet $(DB2MAN) debian/linthesia.xml

override_dh_auto_clean:
	$(RM) debian/linthesia.6
	dh_auto_clean

build-orig-source:
	mkdir -p linthesia-$(VERSION)
	tar --exclude=debian --exclude=\*~ --exclude=.svn --exclude=\*.pyc \
		--exclude=linthesia-$(VERSION) -cf - . \
		| ( cd linthesia-$(VERSION) && tar xf - )
	tar -cf ../linthesia_$(VERSION).orig.tar linthesia-$(VERSION)
	xz ../linthesia_$(VERSION).orig.tar
	$(RM) -r linthesia-$(VERSION)
