#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

include /usr/share/dpkg/pkg-info.mk

export PYBUILD_NAME=gmpy2

%:
	dh $@ --buildsystem pybuild --with python3,sphinxdoc

override_dh_auto_clean:
	dh_auto_clean
	# Remove files generated by the build.
	rm -rf docs/_build
	rm -rf test/__pycache__
	rm -rf build
	rm -rf gmpy2.egg-info

override_dh_auto_build:
	dh_auto_build
	make man html -C $(CURDIR)/docs SPHINXOPTS="-D today=\"$(SOURCE_DATE_EPOCH)\""

override_dh_auto_test:
	dh_auto_test -- --system=custom --test-args="{interpreter} {dir}/test/runtests.py"
