#!/usr/bin/make -f

export DEB_CXXFLAGS_MAINT_APPEND = -DGTEST_USE_OWN_TR1_TUPLE=0

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export DH_OPTIONS

%:
	dh  $@

override_dh_auto_configure:
	dh_auto_configure -- \
		--with-mpi=$(shell pkg-config mpi --variable=includedir | sed s=/include==)

override_dh_auto_build:
	dh_auto_build
	markdown_py -f README.html README.md

override_dh_auto_install:
	dh_auto_install --destdir=debian/tmp
	PATH=debian/tmp/usr/bin:$(PATH) help2man --no-info \
	     -n "Estimate distances between contigs using paired-end alignments." \
	     DistanceEst > debian/tmp/usr/share/man/man1/DistanceEst.1
	PATH=debian/tmp/usr/bin:$(PATH) help2man --no-info \
	     -n "Fill the paired-end fields of SAM alignments" abyss-fixmate \
	     > debian/tmp/usr/share/man/man1/abyss-fixmate.1

override_dh_install:
	dh_install
	for pl in `grep -Rl '#!/usr/bin/env[[:space:]]\+perl' debian/*/usr/*` ; do \
	    sed -i '1s?^#!/usr/bin/env[[:space:]]\+perl?#!/usr/bin/perl?' $${pl} ; \
	done
