#!/usr/bin/make -f
# -*- makefile -*-

#export DH_VERBOSE=1
export DESTDIR=$(CURDIR)/debian/tmp
export DH_ALWAYS_EXCLUDE=.gitignore

BITS:=$(shell dpkg-architecture | grep DEB_BUILD_ARCH_BITS | cut -f 2 -d'=')
ifeq ($(BITS),64)
  64BIT:=yes
else
  64BIT:=no
endif

%:
	dh $@ --parallel --with python2

override_dh_auto_clean:
	$(MAKE) cleanup
	cd doc/manuals; make cleanup
	# should be deleted inside doc/manuals/Makefile
	rm -f doc/manuals/annotationsketch.out \
	      doc/manuals/api_reference.tex    \
	      doc/manuals/gtscript_reference.tex
	find doc . -name "*.toc" -delete
	rm -f www/genometools.org/htdocs/images/callbacks.png \
	      www/genometools.org/htdocs/images/parsed.png    \
	      www/genometools.org/htdocs/images/constructed.png \
	      doc/manuals/annotationsketch.pdf
	rm -f www/genometools.org/htdocs/docs.html \
	      www/genometools.org/htdocs/examples.html \
	      www/genometools.org/htdocs/libgenometools.html
	rm -rf gtpython/build

override_dh_auto_build:
	dh_auto_build --parallel -- useshared=yes 64bit=$(64BIT) opt=no errorcheck=no docs manuals

override_dh_auto_test:
	#dh_auto_test -- useshared=yes 64bit=$(64BIT) testthreads=5

override_dh_auto_install:
	dh_auto_install -- useshared=yes 64bit=$(64BIT) opt=no errorcheck=no prefix=$(DESTDIR)/usr
	dh_auto_install --sourcedirectory=gtpython --destdir=$(CURDIR)/debian/python-genometools

override_dh_strip:
	dh_strip --dbg-package=genometools-dbg
