#!/usr/bin/make -f

export LDFLAGS= $(shell dpkg-buildflags --get LDFLAGS) -shared
export FFLAGS = $(shell dpkg-buildflags --get FFLAGS) -fPIC

VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)-.*/\1/p')

# for backport on stable without bpo
WITH_SPHINXDOC = $(shell if [ -x /usr/bin/dh_sphinxdoc ]; then echo "--with sphinxdoc"; fi)

get-orig-source:
	uscan --force-download --upstream-version $(VERSION) --repack

override_dh_clean:
	# remove the cython generated files distributed by upstream
	rm -f $(patsubst %.pyx,%.c,$(wildcard src/*.pyx))
	rm -rf build
	dh_clean

override_dh_auto_install:
	dh_auto_install
	dh_numpy

%:
	dh $@ --with python2 $(WITH_SPHINXDOC)

.PHONY: get-orig-source
