#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
%:
	dh $@

# The libzt source package contains a bundled copy of zmk. This is similar to
# how autotools injects a copy of itself sufficient to allow bulding the
# project without having to add itself as a build-dependency.
#
# To take advantage of bug fixes present in the Debian version of zmk, remove
# the bundled copy and the generated configuration script. To make Debhelper
# happier use a Debhelper library to restore the modified files when cleaning
# the build tree.
override_dh_update_autotools_config:
	grep ZMK.Version z.mk /usr/include/z.mk
	for fname in configure z.mk zmk/*; do \
		perl  -e "use Debian::Debhelper::Dh_Lib; restore_file_on_clean('$$fname')"; \
		rm -f $$fname; \
	done
	make configure
