#!/usr/bin/make -f

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

# maybe we only need the patchlevel and not the subversion here?
# better safe than sorry, and better consistent with other packages ...
PERL_CURRENT := $(shell perl -MConfig -e 'print "$$Config{revision}.$$Config{patchlevel}.$$Config{subversion}"')
PERL_NEXT    := $(shell perl -MConfig -e 'print "$$Config{revision}.$$Config{patchlevel}." . ($$Config{subversion} + 1)')

include      /usr/share/dpkg/architecture.mk
PERLVER      := $(shell perl -MConfig -e 'print $$Config{version}')
ARCHLIB      := $(shell perl -I/usr/lib/$(DEB_HOST_MULTIARCH)/perl/cross-config-$(PERLVER) -MConfig -e 'print $$Config{vendorarch}')

%:
	dh $@

override_dh_auto_install:
	dh_auto_install
	pod2man --name "common::sense" --utf8 --section 3pm \
		$(TMP)$(ARCHLIB)/common/sense.pod > \
		$(TMP)/usr/share/man/man3/common::sense.3pm

override_dh_gencontrol:
	dh_gencontrol -- -V'sameperl:Depends=perl (>= $(PERL_CURRENT)~), perl (<< $(PERL_NEXT)~)'
