#!/usr/bin/make -f

DH_VERBOSE := 1

include /usr/share/dpkg/default.mk

%:
	dh $@

override_dh_auto_clean:
	cd ./sample_data && for script in ./*/cleanme.pl; do $$($$script); done

override_dh_auto_build:

override_dh_auto_test:
	dh_auto_test
	cd ./sample_data && for script in ./*/cleanme.pl; do $$($$script); done

override_dh_install:
	dh_install
	find debian/transdecoder -name '*.p?' | xargs sed -i \
                's=^#!/usr/local/bin/perl=#!/usr/bin/perl='
	find debian/*/usr/lib/transdecoder -type d -empty -delete

override_dh_installman:
	pod2man --section=1 --center="Transcriptome Protein Prediction" \
		--release="$(DEB_VERSION_UPSTREAM)" TransDecoder.LongOrfs > \
		debian/TransDecoder.LongOrfs.1
	pod2man --section=1 --center="Transcriptome Protein Prediction" \
		--release="$(DEB_VERSION_UPSTREAM)" TransDecoder.Predict > \
		debian/TransDecoder.Predict.1
	dh_installman

override_dh_fixperms:
	dh_fixperms
	chmod -x debian/transdecoder/usr/lib/transdecoder/PerlLib/Fasta_retriever.pm
	find debian -name Process_cmd.pm -exec chmod -x \{\} \;

override_dh_clean:
	# generated man pages
	dh_clean debian/TransDecoder.LongOrfs.1 debian/TransDecoder.Predict.1
