#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

DEBPKGNAME     := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh  $@ --with autoreconf

override_dh_install:
	rm `find debian/tmp -name '*.la'`
	d-shlibmove --commit \
		    --multiarch \
		    --movedev debian/tmp/usr/include/* usr/include \
		    debian/tmp/usr/lib/*/libanfo.so
	dh_install
	mv debian/$(DEBPKGNAME)/usr/lib/* debian/$(DEBPKGNAME)/usr/lib/$(DEBPKGNAME)

override_dh_installman:
	dh_installman
	# delete unused manpage
	find debian/anfo -name anfo-sge.1 -delete

# ./scm files should not be executable
override_dh_fixperms:
	dh_fixperms
	find debian/anfo -perm -5 -type f \( -name '*.scm' \)  -print0 2>/dev/null | xargs -0r chmod 644	
