#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS := hardening=+all

jd_option = --prefix=/usr --mandir=\$${prefix}/share/man \
            --with-sessionlib=xsmp --with-alsa --with-gthread \
	    --with-migemo --with-migemodict=/usr/share/cmigemo/utf-8/migemo-dict

%:
	dh $@ --parallel

override_dh_auto_configure:
	touch $(CURDIR)/debian/generatedfiles
	autoreconf -i
	dh_auto_configure -- $(jd_option)

override_dh_auto_clean: 
	[ ! -f Makefile ] || $(MAKE) clean
	dh_clean 

	-@rm -f $(CURDIR)/config.[a-z]* $(CURDIR)/ltmain.sh $(CURDIR)/install-sh
	-@find $(CURDIR) -name .deps  -exec rm -rf {} \;

	if [ -f $(CURDIR)/debian/generatedfiles ]; then \
	  find $(CURDIR) -path $(CURDIR)/debian -prune -o -name configure.in \
	  -o -name Makefile.am -o -name browsers.cpp -o -name core.cpp \
          -o -name jdversion.h -o -name cache.h -o -name confloader.cpp \
          -o -name misctime.cpp -o -name miscutil.cpp \
	  -o -newer $(CURDIR)/debian/generatedfiles -type f -exec rm {} \; ; \
	fi
	-rm -f $(CURDIR)/debian/generatedfiles

override_dh_installchangelogs:
	dh_installchangelogs ChangeLog

override_dh_compress:
	dh_compress -X.xml
