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

%:
	dh $@

override_dh_auto_build:
	$(PERL) Makefile.PL INSTALLDIRS=vendor
	dh_auto_build -- OPTIMIZE="-Wall -O2 -g"

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

override_dh_auto_install:
	dh_auto_install
	# As this is a architecture independent package, we are not
	# supposed to install stuff to /usr/lib. MakeMaker creates
	# the dirs, we delete them from the deb:
	[ ! -d $(TMP)/usr/lib/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/lib/perl5
