#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
        HOST_PERL = $(shell which perl)
        PERL_VER = $(shell $(HOST_PERL) -v | $(HOST_PERL) -e 'while(<>) {/v(\d+\.\d+\.\d+)/ and print "$$1\n";}')

        export PERL5LIB=/usr/$(DEB_HOST_GNU_TYPE)/lib/perl/$(PERL_VER)
clean:
	@if [ ! -f $(PERL5LIB)/Config.pm ] || [ ! -f $(PERL5LIB)/Config_heavy.pl ]	;\
	then	\
		echo "Config.pm & Config_heavy.pl for cross building not found in $(PERL5LIB)"	;\
	exit 1	;\
	fi
	dh $@
endif

%:
	dh $@

override_dh_perl:
	dh_perl -d
