#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets  by Bill Allombert 2001

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

%:
	dh $@

clean:
	dh clean
	-rm -f docdiff.1

override_dh_auto_build-indep:
	/usr/bin/docbook-to-man debian/manpage.sgml > docdiff.1

override_dh_auto_install:
	$(MAKE) DESTDIR=$(CURDIR)/debian/docdiff PREFIX=/usr install
	sed -e "s/\/usr\/bin\/env ruby/\/usr\/bin\/ruby/" -i $(CURDIR)/debian/docdiff/usr/bin/docdiff
	rm $(CURDIR)/debian/docdiff/usr/share/docdiff/viewdiff.rb
	mv $(CURDIR)/debian/docdiff/usr/share/docdiff/* $(CURDIR)/debian/docdiff/usr/lib/ruby/vendor_ruby/
	rm -rf $(CURDIR)/debian/docdiff/usr/share/docdiff
	rm $(CURDIR)/debian/docdiff/usr/share/doc/docdiff/ChangeLog
	install -o root -g root -m 0644 docdiff.1 $(CURDIR)/debian/docdiff/usr/share/man/man1