#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_auto_clean:
	-$(RM) -rf waflib/__pycache__/
	-$(RM) -rf build/
	-$(RM) -rf waflib/Tools/__pycache__/
	-$(RM) -rf .lock-waf_linux_build
	-$(RM) -rf .pybuild/
	-$(RM) -rf src/python/termboxconfig.pyx
	-$(RM) -rf src/python/termboxmodule.c
	-$(RM) -rf termbox.egg-info

override_dh_auto_configure:
	python3 waf configure \
		--prefix=/usr \
		--libdir=usr/lib/$(DEB_HOST_MULTIARCH)/

override_dh_auto_build:
	python3 waf
	for PY in $(shell py3versions -rs); do \
		$$PY setup.py build; done

override_dh_auto_install:
	python3 waf install \
		--destdir=$(shell pwd)/debian/tmp/
	for PY in $(shell py3versions -rs); do \
		$$PY setup.py install \
			--install-layout=deb \
			--root=$(shell pwd)/debian/tmp; done
