#!/usr/bin/make -f

PY2VERS := $(shell pyversions -s)

# build with -O3 (as upstream does) if noopt is not set
ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
export DEB_CFLAGS_MAINT_APPEND=-O3
endif

%:
	dh $@ --with python2 --buildsystem=python_distutils

override_dh_clean:
	# Keep LEGAL/copy/LICENSE.orig
	dh_clean -XLEGAL/copy/LICENSE.orig

# The normal and debug extensions are split by debian/python-crypto{,-dbg}.install,
# so both interpreters install into one staging tree.
override_dh_auto_build:
	set -e; for python in $(PY2VERS); do \
		$$python setup.py build; \
		$$python-dbg setup.py build; \
	done

override_dh_auto_install:
	set -e; for python in $(PY2VERS); do \
		$$python setup.py install --install-layout=deb --root $(CURDIR)/debian/tmp; \
		$$python-dbg setup.py install --install-layout=deb --root $(CURDIR)/debian/tmp; \
	done

override_dh_auto_test:
