#!/usr/bin/make -f

# DH_VERBOSE := 1

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

export PYBUILD_NAME=pyosmium

%:
	dh $@ \
	    --buildsystem pybuild \
	    --with python2,python3 \
	    --parallel

override_dh_clean:
	dh_clean
	
	$(RM) -r doc/_build

override_dh_auto_build-indep:
	dh_auto_build --indep

	(cd doc && PYTHONPATH=$(CURDIR)/.pybuild/pythonX.Y_`py3versions -vd`/build make html)
	(cd doc && PYTHONPATH=$(CURDIR)/.pybuild/pythonX.Y_`py3versions -vd`/build make man)

override_dh_auto_test:
	PYBUILD_SYSTEM=custom \
	PYBUILD_TEST_ARGS="cd test && {interpreter} run_tests.py" dh_auto_test

override_dh_auto_install:
	PYBUILD_INSTALL_ARGS="--install-scripts=/usr/lib/{package}" dh_auto_install

override_dh_install:
	dh_install

	# Remove embedded jquery.js in favor of libjs-jquery
	$(RM) debian/*/usr/share/doc/*/html/_static/jquery.js

	# Remove embedded underscore.js in favor of libjs-underscore
	$(RM) debian/*/usr/share/doc/*/html/_static/underscore.js

