#!/usr/bin/make -f

%:
	dh $@ --with python2

build_test_recipe:
	(cd test/iiinstrumentp && ./bootstrap && ./configure && make CPPFLAGS="$$CPPFLAGS -D_XOPEN_SOURCE=500")

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test: build_test_recipe
	for PYTHON in $(shell pyversions -r); do \
	    $$PYTHON setup.py build_ext -i && \
	    MALLOC_CHECK_=0 PYTHONPATH=$$(pwd) $$PYTHON test/TestRecipe.py \
	        || exit $$? ; \
	done
endif

override_dh_install:
	dh_install
	find debian -name recipe.py -exec sed s+DEB_HOST_MULTIARCH+$(DEB_HOST_MULTIARCH)+g -i {} \;

override_dh_shlibdeps:
	dh_shlibdeps
	dh_numpy
