#!/usr/bin/make -f

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

# not needed, but for convenience when I work by hand:
#export QUILT_PATCHES=debian/patches

PACKAGE=gwaei

export DEB_CFLAGS_MAINT_APPEND = -ffile-prefix-map=$(CURDIR)=.
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
	dh $@

override_dh_clean:
	rm -f config.status Doxyfile config.h stamp-h1 config.log
	rm -f Makefile help/gwaei.omf help/Makefile po/Makefile libtool
	rm -f po/POTFILES po/Makefile.in rpm/rpm_gconf_install_post.sh
	rm -f po/stamp-it
	rm -f rpm/fedora/SPECS/gwaei.spec rpm/gwaei.spec
	rm -f src/gwaei/doxyfile
	rm -f src/gwaei/Makefile
	rm -f src/gwaei/help/Makefile src/gwaei/help/gwaei.omf
	rm -f src/gwaei/ui/Makefile
	rm -f src/gwaei/include/gwaei/Makefile
	rm -f src/libwaei/doxyfile
	rm -f src/libwaei/Makefile src/libwaei/include/libwaei/Makefile
	rm -f src/waei/doxyfile src/waei/Makefile
	rm -f src/waei/include/waei/Makefile
	rm -f src/images/Makefile
	rm -f src/Makefile src/xml/Makefile src/kpengine/Makefile
	rm -f mandir/Makefile
	rm -rf src/kpengine/.deps src/.deps
	rm -f src/desktop/Makefile src/schemas/Makefile
	rm -f src/img/Makefile
	dh_clean

override_dh_auto_configure:
	dh_auto_configure --	\
		--sysconfdir=/usr/share	\
		--libdir='$${prefix}/lib' \
		--disable-scrollkeeper

override_dh_auto_install:
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp


override_dh_installdocs:
	dh_installdocs NEWS README THANKS
	# GPL is shipped globally, and mentioned in the copyright file
	rm -f $(CURDIR)/debian/$(PACKAGE)/usr/share/doc/gwaei/COPYING
	# this will be already installed by dh_installchangelogs below
	rm -f $(CURDIR)/debian/$(PACKAGE)/usr/share/doc/gwaei/ChangeLog
