#!/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

TMP     =$(CURDIR)/debian/$(PACKAGE)

build: build-stamp
build-stamp:
	dh_testdir

	# Add commands to compile the package here
	$(PERL) Makefile.PL INSTALLDIRS=vendor
	$(MAKE) OPTIMIZE="-Wall -O2 -g"

	touch build-stamp

clean:
	dh_testdir
	dh_testroot

	[ ! -f Makefile ] || $(MAKE) realclean

	dh_clean build-stamp install-stamp

# do not run this automatically from the build/install targets, as it will
# need an internet connection to connect to the IMDB
test:
	$(MAKE) test

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

	# install files
	$(MAKE) install DESTDIR=$(TMP) PREFIX=/usr

	-rm -rf $(TMP)/usr/lib

	touch install-stamp

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

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

binary: binary-indep binary-arch

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

# vim:ft=make:fileencoding=utf-8:ts=4:
