#!/usr/bin/make -f

# Enable compiler hardening flags.  Do not enable PIE; it interferes with
# some of the things that gnubg does to probe for supported CPU
# instructions.
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow,+pie

%:
	dh $@

# We can't use dh-autoreconf because autoheader doesn't work with the
# upstream build system.
override_dh_auto_configure:
	autoconf
	dh_auto_configure -- --disable-version --disable-version-symlink \
	    --program-suffix=5 --datadir=\$${prefix}/share/tf5 \
	    --enable-mailcheck=/var/mail --enable-256colors --enable-ssl

override_dh_auto_build:
	$(MAKE) STRIP=:

override_dh_auto_clean:
	$(MAKE) -f unix/Makefile distclean

override_dh_auto_install:
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tf5 STRIP=:
	install -d $(CURDIR)/debian/tf5/usr/share/man/man1
	install -m 644 src/tf.1.nroffman \
	    $(CURDIR)/debian/tf5/usr/share/man/man1/tf5.1
