#!/usr/bin/make -f

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Ensure the build is reproducible
export LC_ALL=C.UTF-8
export LANGUAGE=C.UTF-8

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- --enable-docs

override_dh_installexamples:
	dh_installexamples --exclude=__run_all.sh

override_dh_auto_test:
	# testsuite requires Python multiprocessing.Pool()
	/bin/sh -c 'python3 -c "from multiprocessing import Pool; pool = Pool(); pool.close()" \
		&& dh_auto_test \
		|| echo "Support for multiprocessing.Pool() missing, skipping testsuite"'

execute_after_dh_auto_test:
	# ensure failed tests are visible in the buildlog
	/bin/sh -c 'cat test-suite.log || true'

execute_after_dh_link:
	# Deal with some duplicate files in examples
	jdupes -rl debian/re2c/usr/share/doc/re2c
