#!/usr/bin/make -f

PACKAGE=$(shell awk '/^Package:/ {print $$2}' ./debian/control)
DESTDIR=$(CURDIR)/debian/$(PACKAGE)

build: build-arch build-indep

build-arch: build-stamp
build-indep: build-stamp

build-stamp:
	dh_testdir
	$(MAKE) PERLINT=perl
	touch $@

clean:
	dh_testdir
	dh_testroot
	-rm -f build-stamp *~ debian/*~ configure-stamp
	$(MAKE) clean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	$(MAKE) install MANDIR=share/man PREFIX=/usr INSTALLROOT=$(DESTDIR)

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installchangelogs ChangeLog
	dh_compress
	dh_fixperms
	dh_perl
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch: build install
# nothing to do

# Below here is fairly generic really

binary:		binary-indep binary-arch

.PHONY: binary binary-arch binary-indep clean
