#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DH_VERBOSE=1
export DH_OPTIONS=-v

include /usr/share/dpkg/default.mk

%:
	dh $@

execute_before_dh_auto_clean:
	find . -name Makefile -delete
	# restore reprof.spec which is removed in the build process
	if [ ! -e reprof.spec ] \
	; then sed 's/@VERSION@/$(DEB_VERSION_UPSTREAM)/' reprof.spec.in \
	       > reprof.spec \
	; fi

execute_after_dh_auto_build:
	# Build process somehow removes lib/RG/Reprof.pm
	# make sure it exists to be able to build twice in a row
	if [ ! -e lib/RG/Reprof.pm ] ; then cp lib/RG/Reprof.pm.mk lib/RG/Reprof.pm ; fi


override_dh_auto_install:
	# The following will run: perl Build install
	dh_auto_install
	# But we also need this to get the correct script
	DESTDIR=$(CURDIR)/debian/tmp make install

override_dh_compress:
	dh_compress -Xexample.Q
