#!/usr/bin/make -f

export DH_VERBOSE=1
export AUTOHEADER=true
export DEB_BUILD_MAINT_OPTIONS=hardening=+pie
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
export LOGNAME:=buildd
export PATH:=/usr/bin:/bin

%:
	dh $@

override_dh_auto_clean:
	dh_auto_clean
	rm -rf obj/ lib/32xx/32xx-deplibs.mk
	find . \
		-name Makefile -or \
		-name Makefile.obj -or \
		-name config.log -or \
		-name config.status -or \
	       	-name conf.h | xargs -r rm

override_dh_auto_configure:
	dh_auto_configure -- \
		--with-fontdir=/usr/share/fonts/X11/misc \
		--enable-x3270 \
		--enable-c3270 \
		--enable-s3270 \
		--enable-b3270 \
		--enable-tcl3270 \
		--enable-pr3287 \
		--enable-x3270if \
		--enable-lib \
		CCOPTIONS='$(CFLAGS)'

override_dh_auto_install:
	dh_auto_install --no-parallel -- install.man
