#!/usr/bin/make -f

# rules for debsums

version=$(shell dpkg-parsechangelog | sed -n 's/^Version: *//p')
package=debsums
tmp=debian/$(package)

export DH_COMPAT = 5

build: # nothing
clean:
	dh_testdir
	dh_testroot
	dh_clean
	debconf-updatepo
	cd man && po4a --no-translations --rm-backups po4a.cfg
	rm -f man/po/*~ man/*/debsums*.[18]

binary-arch: # nothing
binary-indep:
	dh_testdir
	dh_testroot
	dh_clean -k

	mkdir -p $(tmp)/usr/bin $(tmp)/usr/sbin
	sed 's/#VERSION#/$(version)/' debsums.in >$(tmp)/usr/bin/debsums
	cp debsums_gen debsums_init $(tmp)/usr/sbin
	chmod 755 $(tmp)/usr/bin/debsums $(tmp)/usr/sbin/debsums_gen \
	    $(tmp)/usr/sbin/debsums_init

	dh_installdocs README
	cd man && po4a --rm-backups po4a.cfg
	dh_installman `find man -type f -name '*.[18]'`

	dh_installchangelogs
	dh_installdebconf
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary:	binary-indep binary-arch

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