#!/usr/bin/make -f

include /usr/share/postgresql-common/pgxs_debian_control.mk

export PYBUILD_NAME=multicorn

%:
	dh $@ --with python2,python3 --buildsystem=pybuild

override_dh_auto_build:
#	Invoke python build process for the common python module.
	dh_auto_build

# ignore testsuite failure until #795590 is resolved
# (upstream https://github.com/Kozea/Multicorn/issues/128)
override_dh_auto_test:
	-dh_auto_test --buildsystem=pybuild

override_dh_auto_install:
#	Build the extension via pg_buildext.
	+PYTHON_OVERRIDE=python2 pg_buildext loop postgresql-%v-python-multicorn
	+PYTHON_OVERRIDE=python3 pg_buildext loop postgresql-%v-python3-multicorn

	dh_auto_install

override_dh_installdocs:
	dh_installdocs --all README*

override_dh_python2:
	# we don't support 2.6 on wheezy, only 2.7
	dh_python2 -O--buildsystem=pybuild --no-guessing-versions

override_dh_auto_clean:
	$(MAKE) clean
	dh_auto_clean
	rm -rf regression.diffs regression.out results .cache
	mkdir results # prepare results dir for next adt run
