#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules for perlftlib

export DH_COMPAT=4

package	:= $(firstword $(shell dh_listpackages))
prefix	:= $(PWD)/debian/$(package)/usr

version	:= $(shell dpkg-parsechangelog | \
			sed -ne 's/^Version: *\([0-9]\+:\)*//p')

tag:
	cvs tag -c -F $(subst .,_,debian_version_$(version))
ifeq ($(findstring -,$(version)),)
	cvs tag -c -F $(subst .,_,upstream_version_$(version))
endif

build:	build-stamp
build-stamp:
	dh_testdir
	./html2ps -o html2ps.ps html2ps.html
	cp -a contrib/xhtml2ps/README README.xhtml2ps
	touch $@

clean:	checkroot
	rm -f build-stamp
	rm -f html2ps.ps README.xhtml2ps
	dh_clean

binary-arch:	checkroot build

binary-indep:	checkroot build
	dh_clean
	dh_installdirs /etc usr/bin

	install -m 755 html2ps contrib/xhtml2ps/xhtml2ps $(prefix)/bin
	install -m 644 -p debian/html2psrc $(prefix)/../etc

	dh_installdocs html2ps.ps html2ps.html README README.xhtml2ps
	dh_installexamples debian/html2psrc sample hyphen.tex
	dh_installman *.[15] debian/*.1x
	dh_installchangelogs
	dh_compress
	dh_fixperms
	dh_perl
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary:	binary-indep binary-arch

checkroot:
	dh_testdir
	dh_testroot

.PHONY: binary binary-arch binary-indep clean checkroot build
