#!/usr/bin/make -f

# rules for debsums

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

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_prep
	dh_installdirs

	sed 's/#VERSION#/$(version)/' debsums.in >$(tmp)/usr/bin/debsums
	cp debsums_gen debsums_init $(tmp)/usr/sbin
	cp rdebsums $(tmp)/usr/bin
	chmod 755 $(tmp)/usr/bin/debsums $(tmp)/usr/sbin/debsums_gen \
	    $(tmp)/usr/sbin/debsums_init $(tmp)/usr/bin/rdebsums
	touch $(tmp)/etc/debsums-ignore
	dh_installdocs README
	cd man && po4a --rm-backups po4a.cfg
	dh_installman `find man -type f -name '*.[18]'`

	dh_lintian
	dh_installcron
	dh_installinit
	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
