#!/usr/bin/make -f

DEB_CFLAGS_MAINT_APPEND = -DNDEBUG
DEB_CXXFLAGS_MAINT_APPEND = -DNDEBUG
DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
	dh $@ --builddirectory=builddir

override_dh_auto_configure:
	RSH=rsh LPR=lpr XTERM=xterm XFONTSEL=xfontsel \
        GCORE=gcore ice_cv_find_xp=no ac_cv_lib_Xp_XpSelectInput=no \
	dh_auto_configure -- --with-readline-libraries \
	    --disable-builtin-app-defaults --disable-builtin-manual \
	    --disable-builtin-news --disable-builtin-license \
	    --with-userinfo="$(shell dpkg-parsechangelog -SMaintainer)"

override_dh_auto_test:
	# Disable the make check command, which wants to run ddd interactively

override_dh_auto_install:
	dh_auto_install
	rm -f debian/tmp/usr/share/ddd/COPYING

override_dh_auto_clean:
	dh_auto_clean
	rm -f ddd/ddd.info.txt ddd/ddd.info.txt.gz
	rm -f ddd/ddd.info.txt.gz.C

override_dh_install:
	dh_install
	# The manpage installed contains a reference to a logo .eps file in the
	# build directory which isn't even created; remove this reference to
	# eliminate man warnings.
	sed -i -e '/^\.PSPIC/d' debian/ddd/usr/share/man/man1/ddd.1
