#!/usr/bin/make -f

PYTHON3:=$(shell py3versions -r)
py3sdo=set -e; $(foreach py, $(PYTHON3), $(py) $(1);)

%:
	dh $@ --with=python2,python3,autoreconf

override_dh_auto_clean:
	dh_auto_clean --buildsystem=autoconf
	dh_auto_clean --buildsystem=python_distutils

override_dh_auto_configure:
	dh_auto_configure --buildsystem=autoconf
	dh_auto_configure --buildsystem=python_distutils

override_dh_auto_build:
	dh_auto_build --buildsystem=autoconf
	dh_auto_build --buildsystem=python_distutils
	$(call py3sdo, setup.py build)

override_dh_auto_install:
	dh_auto_install --buildsystem=autoconf
	dh_auto_install --buildsystem=python_distutils
	$(call py3sdo, setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb)

override_dh_fixperms:
	dh_fixperms
	test -e /usr/bin/dh_buildinfo && dh_buildinfo

# Custom rules used only during development

debsrc:
	debian/vercheck
	git-buildpackage -S -us -uc
	rm -f ../$(RELEASE_PACKAGE)_$(VERSION)_source.changes

