#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PYBUILD_NAME=drgn

# tools and util.py do not get installed
export PYBUILD_BEFORE_TEST=cp -pr {dir}/tools {dir}/util.py {build_dir}
export PYBUILD_AFTER_TEST=rm -r {build_dir}/tools {build_dir}/util.py

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

clean:
	dh $@ --with python3 --buildsystem=pybuild

# need to override to get a verbose build
override_dh_auto_build:
	V=1 dh_auto_build

# force use of pybuild, otherwise dh_auto_clean will try to use
# distutils which is no longer supported since compat 12
# since setup.py exists
override_dh_auto_clean:
	dh_auto_clean --buildsystem=pybuild

execute_after_dh_auto_build: export http_proxy=127.0.0.1:9
execute_after_dh_auto_build: export https_proxy=127.0.0.1:9
execute_after_dh_auto_build:
	PYTHONPATH=. python3 -m sphinx -N -bhtml \
	docs/ build/html # HTML generator
	PYTHONPATH=. python3 -m sphinx -N -bman \
	docs/ build/man # Manpage generator
