#!/usr/bin/make -f

# DH_VERBOSE := 1
export LC_ALL=C.UTF-8

include /usr/share/dpkg/default.mk

# for hardening you might like to uncomment this:
# export DEB_BUILD_MAINT_OPTIONS=hardening=+all

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

override_dh_auto_build: export http_proxy=127.0.0.1:9
override_dh_auto_build: export https_proxy=127.0.0.1:9
override_dh_auto_build:
	dh_auto_build
	sphinx-apidoc -f -o docs/autodocs/source/bmtk/ bmtk
	PYTHONPATH=. python3 -m sphinx -N -bhtml docs/autodocs/source/ build/html # HTML generator

override_dh_install:
	find . -name "*" -size 0 -print0 -exec rm {\} \;
	find . -name "*.json" -exec chmod -x {\} \;
	find . -name "*.nml" -exec chmod -x {\} \;
	find . -name "*.swc" -exec chmod -x {\} \;
	find . -name "*.csv" -exec chmod -x {\} \;
	find . -name "*.h5" -exec chmod -x {\} \;
	find docs/examples/ -name "*.py" -exec sed -i '1i\#!/usr/bin/python3' {\} \;
	dh_install
