#!/usr/bin/make -f
# -*- makefile -*-
# This has to be exported to make some magic below work.
export DH_OPTIONS

# set the MPLCONFIGDIR to avoid writing into non writable location
export HOME=$(CURDIR)/build
export MPLCONFIGDIR=$(CURDIR)/build

%:
	dh $@ --buildsystem=python_distutils

# Assure Agg backend for matplotlib to avoid any possible complication
override_dh_auto_configure:
	mkdir -p $(MPLCONFIGDIR)
	echo "backend : Agg" >| $(MPLCONFIGDIR)/matplotlibrc
	dh_auto_configure

override_dh_auto_test:
	${MAKE} test
	dh_auto_test

override_dh_auto_build:
	$(MAKE) -C src libpsipp.so
	# Inject debian version into binary package
	echo "version = \"$$(dpkg-parsechangelog  | grep Version | cut -f2 -d' ')\"">> pypsignifit/__version__.py
	$(MAKE) swig
	dh_auto_build

override_dh_auto_clean:
	dh_auto_clean
	$(MAKE) clean
