#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. 
# This file is public domain software, originally written by Joey Hess.
#
# This version is for packages that are architecture independent.

package = po-debiandoc

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

prefix = debian/$(package)

build: build-stamp
build-stamp:
	dh_testdir
	cd doc && pod2man --section=1 --center='DebianDoc-SGML Tools' --release='DebianDoc-SGML Tools' $(package).pod > $(package).1
	cp doc/$(package).7.pod $(package).pod && pod2man --section=7 --center='DebianDoc-SGML Tools' --release='DebianDoc-SGML Tools' $(package).pod > doc/$(package).7 && rm -f $(package).pod
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f doc/$(package).?
	rm -f build-stamp
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	install -c -m 755 bin/debiandoc-gettextize  $(prefix)/usr/bin/
	install -c -m 755 bin/debiandoc2pot         $(prefix)/usr/bin/
	install -c -m 755 bin/po2debiandoc          $(prefix)/usr/bin/
	install -c -m 755 lib/sgmlspl-l        $(prefix)/usr/share/$(package)/
	install -c -m 755 lib/flat.pl          $(prefix)/usr/share/$(package)/
	install -c -m 755 lib/flat2po.pl       $(prefix)/usr/share/$(package)/
	install -c -m 755 lib/flat2pot.pl      $(prefix)/usr/share/$(package)/
	install -c -m 755 lib/po-debiandoc-fix $(prefix)/usr/share/$(package)/

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
#	dh_installdebconf
	dh_installdocs
#	dh_installexamples
#	dh_installmenu
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
#	dh_installcron
	dh_installman doc/$(package).?
#	dh_installinfo
#	dh_undocumented
	dh_installchangelogs
	dh_link \
  usr/share/man/man1/$(package).1 usr/share/man/man1/debiandoc-gettextize.1 \
  usr/share/man/man1/$(package).1 usr/share/man/man1/debiandoc2pot.1 \
  usr/share/man/man1/$(package).1 usr/share/man/man1/po2debiandoc.1
	dh_compress
	dh_fixperms
	dh_installdeb
#	dh_perl
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-dependent files here.
binary-arch: build install
# We have nothing to do by default.

binary: binary-indep binary-arch

#     Shortcuts
deb:
	dpkg-buildpackage -rfakeroot -ICVS -I.cvsignore -I.scvsrc -I\*.patch

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