#!/usr/bin/make -f

DH_VERBOSE=1

export LC_ALL=C.UTF-8
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow
export PYBUILD_NAME=fastcluster

# Taken from CDBS file for R.
rversion	:= $(shell dpkg-query -W -f='$${Version}' r-base-dev)
rapiversion	:= $(shell dpkg-query -W -f='$${Provides}' r-base-core | grep -o 'r-api[^, ]*')

%:
	dh $@ --buildsystem=pybuild --sourcedirectory=src/python

override_dh_auto_clean:
	dh_auto_clean || true

	if test -d src; then			\
		find src -name "*.o"  -delete ; \
		find src -name "*.so" -delete ; \
	fi
	rm -f config.log config.status
	rm -rf tmp-install

override_dh_auto_install:
	dh_auto_install -O--buildsystem=R --sourcedirectory=$(CURDIR)
	mv debian/tmp tmp-install
	dh_auto_install

override_dh_install:
	dh_numpy3
	dh_install
	find debian -name LICENSE -delete
