#!/usr/bin/make -f
%:
	dh  $@

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs -Wl,--as-needed

override_dh_auto_clean:

	if [ -f Makefile ] ; then $(MAKE) maintainer-clean ; fi

	# Things upstream's distclean missed.
	-rm -f intltool-extract
	-rm -f intltool-merge
	-rm -f intltool-update

	# Autotools generated files.
	-rm -f aclocal.m4
	-rm -f config.guess
	-rm -f config.h.in
	-rm -f config.log
	-rm -f config.sub
	-rm -f configure
	-rm -f depcomp
	-rm -f intltool-extract.in
	-rm -f intltool-merge.in
	-rm -f intltool-update.in
	-rm -f ltmain.sh
	-rm -f po/Makefile.in.in

	find -name Makefile.in -delete
	find -name .cvsignore  -delete

override_dh_auto_configure:

	libtoolize
	intltoolize
	aclocal
	autoheader
	automake -a
	autoconf

	rm -f config.cache

	UPDATE_DESKTOP_DATABASE=/bin/true \
	UPDATE_MIME_DATABASE=/bin/true \
	./configure \
	    --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
	    --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info \
	    $(shell dpkg-buildflags --export=configure)

override_dh_auto_install:

	dh_auto_install
	cp -a debian/sb*.asc debian/tmp/usr/share/gbonds/
	chmod 644 debian/tmp/usr/share/gbonds/sb*.asc
