#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_build:
	cp -a Makefile Makefile~
	xmkmf -a
	dh_auto_build
	mv Makefile~ Makefile

override_dh_auto_clean:
	[ -f Makefile ] || xmkmf -a
	[ ! -f Makefile ] || $(MAKE) clean
# Note that we don't delete Makefile itself here as you would expect.
# This is because upstream shipped with Makefile, so we leave the one
# we generate.  Of course, it almost certainly won't be the same as
# the one upstream shipped...  Stupidity propagation I guess.
	if [ -f Makefile~ ] ; then mv Makefile~ Makefile ; fi
