#!/usr/bin/make -f
include /usr/share/dpkg/architecture.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic

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

override_dh_auto_configure:
	mkdir build && cd build
	cmake -DCMAKE_LIBRARY_ARCHITECTURE=${DEB_HOST_MULTIARCH} -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON -DCMAKE_INSTALL_PREFIX=/usr

override_dh_auto_build:
	make
	pybuild --build

override_dh_install:
	make install DESTDIR=debian/tmp
	pybuild --install
	dh_install

override_dh_auto_clean:
	if test -f Makefile; then \
	   make clean ; \
	fi
	rm -rf build/ .pybuild/ CMakeFiles/ cmsat5-src/ src/pycryptosat.egg-info/ include/
	rm -f CMakeCache.txt Makefile compile_commands.json *.cmake install_manifest.txt
	rm -f cryptominisat5.1