#!/usr/bin/make -f

# DH_VERBOSE := 1
export LC_ALL=C.UTF-8

# for hardening you might like to uncomment this:
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

include /usr/share/dpkg/default.mk

MSSSSE3=$(shell if [ `dpkg-architecture -qDEB_BUILD_ARCH` = 'amd64' ] ; then echo "-mssse3" ; fi)

%:
	dh $@

override_dh_install:
	dh_install
	# due to a file name conflict diamond is moved out of the way
	mkdir -p debian/$(DEB_SOURCE)/usr/lib/debian-med/bin/
	mv debian/$(DEB_SOURCE)/usr/bin/diamond debian/$(DEB_SOURCE)/usr/lib/debian-med/bin/

override_dh_installman:
	dh_installman
	# due to a file name conflict diamond.1 is moved out of the way
	mkdir -p debian/$(DEB_SOURCE)/usr/lib/debian-med/share/man/man1/
	mv debian/$(DEB_SOURCE)/usr/share/man/man1/diamond.1 debian/$(DEB_SOURCE)/usr/lib/debian-med/share/man/man1/
	gzip -9 debian/$(DEB_SOURCE)/usr/lib/debian-med/share/man/man1/diamond.1

override_dh_compress:
	dh_compress --exclude=.pdf

override_dh_fixperms:
	dh_fixperms
	# strangely the manpage becomes executable ... hmmm
	chmod -x debian/$(DEB_SOURCE)/usr/lib/debian-med/share/man/man1/*

build_simple:
	MSSSSE3=$(MSSSSE3) build_simple.sh
