#!/usr/bin/make -f

#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export PYBUILD_NAME=sep
export PYBUILD_SYSTEM=distutils
export SEP_LIB_PATH=$(CURDIR)/obj-$(DEB_TARGET_GNU_TYPE)

PY3VERS ?= $(shell py3versions -vr)

%:
	dh $@ --with python3

override_dh_auto_clean:
	dh_auto_clean -O--buildsystem=cmake
	dh_auto_clean -O--buildsystem=pybuild

override_dh_auto_configure:
	dh_auto_configure -O--buildsystem=cmake
	dh_auto_configure -O--buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build -O--buildsystem=cmake
	dh_auto_build -O--buildsystem=pybuild

override_dh_auto_install:
	dh_auto_install -O--buildsystem=cmake
	dh_auto_install -O--buildsystem=pybuild

override_dh_auto_test:
	for py in $(PY3VERS); do \
	  PYTHONPATH=.pybuild/cpython3_$${py}_sep/build \
	  LD_LIBRARY_PATH=$(CURDIR)/obj-$(DEB_TARGET_GNU_TYPE) \
	  python$${py} -m pytest test.py; \
	done

execute_before_dh_python3:
	dh_numpy3
