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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# Enable hardening build flags
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

export PYBUILD_NAME=pyresample
export USE_CYTHON=True
export PYBUILD_TEST_ARGS=-k "not test_compare_to_legacy and not legacy_dask_ewa"

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


override_dh_auto_build:
	dh_auto_build --buildsystem=pybuild
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	env PYTHONPATH=$(CURDIR) $(MAKE) -C docs html
	rm -rf docs/build/html/_static/images/
else
	mkdir -p docs/build/html
endif


override_dh_auto_install:
	dh_auto_install -ppython-pyresample-test --buildsystem=pybuild
	dh_auto_install -X.dat -X.npz --buildsystem=pybuild --remaining
	$(RM) -r debian/python3-pyresample/usr/lib/python3*/dist-packages/pyresample/test/test_files


override_dh_auto_clean:
	dh_auto_clean --buildsystem=pybuild
	$(MAKE) -C docs clean
	$(RM) -r build pyresample.egg-info pyresample/ewa/*.so
	$(RM) pyresample/ewa/_fornav.cpp pyresample/ewa/_ll2cr.c pyresample/gradient/_gradient_search.c


override_dh_installchangelogs:
	dh_installchangelogs README.md


override_dh_python3:
	dh_python3 -ppython3-pyresample
	dh_numpy3 -ppython3-pyresample
