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

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

PKG := $(shell dpkg-parsechangelog | sed -n 's/^Source: //p')

%:
	dh $@ --with python2

override_dh_clean:
	#These files are rebuilt on-the-fly
	for f in `find -name '*.c'` ; do \
	    head -n 1 "$$f" | grep -q '^/\* Generated by Cython' && rm "$$f" ; \
	done
	rm -rf build build-stamp
	rm -rf doc/_build
	dh_clean

override_dh_auto_build:
	dh_auto_build
	cd doc; $(MAKE) html
	# remove superfluous files and dirs
	rm -f doc/_build/doctrees/COGENT_LICENSE.doctree
	rm -f doc/_build/html/_sources/COGENT_LICENSE.txt
	rm -f doc/_build/html/_static/jquery.js
	rm -f doc/_build/html/_static/underscore.js
	rm -rf doc/_build/html/_images/math/

override_dh_shlibdeps:
	dh_shlibdeps
	dh_numpy

override_dh_compress:
	dh_compress --exclude=.js --exclude=.fasta --exclude=.txt --exclude=.pdb

override_dh_installdocs:
	dh_installdocs
	rm -rf debian/$(PKG)/usr/share/doc/$(PKG)/html/_sources

override_dh_strip:
	dh_strip --dbg-package=python-cogent-dbg

get-orig-source:
	mkdir -p ../tarballs
	uscan --verbose --force-download --destdir=../tarballs

