#!/usr/bin/make -f

build3vers := $(shell py3versions -sv)

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

%:
	dh $@ --with python3

override_dh_auto_build:
	set -e && for i in $(build3vers); do \
	  cd src ; swig -c++ -python  pykcs11.i ; cp pykcs11_wrap.cxx pykcs11_wrap.cpp ; cp LowLevel.py ../PyKCS11 ; \
	  cd .. ; python$$i setup.py build; \
	done


override_dh_auto_install:
	set -e && for i in $(build3vers); do \
	  python$$i setup.py install --install-layout=deb --root $(CURDIR)/debian/python3-pykcs11; \
	done

override_dh_auto_clean:
	python3 setup.py clean
