#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# If set to a true value then MakeMaker's prompt function will
# always return the default without waiting for user input.
export PERL_MM_USE_DEFAULT=1

PACKAGE=$(shell dh_listpackages)

ifndef PERL
PERL = /usr/bin/perl
endif

BUILD = ./Build
TMP	=$(CURDIR)/debian/tmp


build: build-stamp
build-stamp:
	dh_testdir

	touch build-stamp

clean:
	dh_testdir
	dh_testroot

	dh_clean -d
	rm -f build-stamp install-stamp

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -d -k

	$(PERL) $(BUILD) install destdir=$(TMP)
	-find . -type f | grep '/perllocal.pod$$' | xargs rm -f

	# due to a bug in M::B, the .packlist file is written to
	# the wrong directory, causing file conflicts:
	# http://rt.cpan.org/Ticket/Display.html?id=18162
	# remove it for now
	-find . -type f | grep '/.packlist$$' | xargs rm -f
	
	dh_movefiles /usr

	touch install-stamp

binary-arch:
# We have nothing to do by default.

binary-indep: build install
	dh_testdir
	dh_testroot



### doc/changelog install lines
	-dh_installdocs
	-dh_installchangelogs



	dh_perl /usr/local/share/perl/5.28.1 /usr/local/lib/x86_64-linux-gnu/perl/5.28.1
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

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

