#!/usr/bin/make -f
# -*- makefile -*-

#export DH_VERBOSE=1

export DISABLE_NUMCODECS_SSE2=1
export DISABLE_NUMCODECS_AVX2=1

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
export PYBUILD_NAME=numcodecs
export PYBUILD_TEST_ARGS=\
-k "not test_non_numpy_inputs \
and not test_non_numpy_inputs \
and not test_native_functions" \
--pyargs ${PYBUILD_NAME}
export PYBUILD_AFTER_TEST=rm -rf {build_dir}/fixture {build_dir}/.coverage {build_dir}/coverage.xml

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_build:
	dh_auto_build
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	cd docs && \
	env PYTHONPATH=$(shell pybuild --build -i python3 -s custom --build-args 'echo {build_dir}') \
	    http_proxy='http://127.0.0.1:9/' https_proxy='https://127.0.0.1:9/' \
	python3 -m sphinx -N -E -T -b html . $(CURDIR)/.pybuild/docs/html/
	$(RM) -r $(CURDIR)/.pybuild/docs/html/_static/vendor/fontawesome/5.13.0/webfonts/* \
		 $(CURDIR)/.pybuild/docs/html/_static/vendor/fontawesome/5.13.0/LICENSE.txt
endif
