#!/usr/bin/make -f

export DH_OPTIONS
pkg := $(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
EXTRA_CONFIGURE_ARGS =
ifeq ($(DEB_HOST_ARCH), i386)
EXTRA_CONFIGURE_ARGS += --enable-sse4.1=no --enable-sse4.2=no
endif


%:
	dh  $@ --with autotools_dev

override_dh_auto_configure:
	dh_auto_configure -- --enable-shared --with-gmapdb=/var/cache/gmap --bindir=/usr/lib/gmap $(EXTRA_CONFIGURE_ARGS)

override_dh_install:
	dh_install
	mkdir -p debian/$(pkg)/usr/bin
	ln -s /usr/lib/gmap/gmap debian/$(pkg)/usr/bin/gmap
	ln -s /usr/lib/gmap/gsnap debian/$(pkg)/usr/bin/gsnap
	ln -s /usr/lib/gmap/gmap_build debian/$(pkg)/usr/bin/gmap_build
