#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

include /usr/share/dpkg/default.mk

pkg := $(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
version=$(shell dpkg-parsechangelog -ldebian/changelog | grep Version: | cut -f2 -d' ' | cut -f1 -d- )
mandir=$(CURDIR)/debian/$(pkg)/usr/share/man/man1
bindir=$(CURDIR)/debian/$(pkg)/usr/bin

%:
	dh $@ --with autoreconf

override_dh_builddeb:
	dh_builddeb -- -Z xz

override_dh_auto_configure:
	dh_auto_configure -- --with-boost-libdir=/usr/lib/$(DEB_HOST_MULTIARCH)

override_dh_auto_install:
	dh_auto_install

	# try to create man pages whereever possible
	mkdir -p $(mandir)
	help2man --no-info --no-discard-stderr  -h "" \
	    --name='converts bam directly into fastx' \
	    --version-string="$(version)" \
	         $(bindir)/bam2fastx > $(mandir)/bam2fastx.1
	help2man --no-info --no-discard-stderr \
	    --name='TopHat maps short sequences from spliced transcripts to whole genomes' \
	    --version-string="$(version)" \
	         $(bindir)/tophat > $(mandir)/tophat.1
