#!/usr/bin/make -f
#export DH_VERBOSE=1

export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

ifneq (,$(KDU_ROOT))
LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(KDU_ROOT)/apps/make
WITH_KAKDU = --with-kakadu=$(KDU_ROOT)
endif

%:
	dh $@ --with autotools_dev

override_dh_auto_configure:
	autoreconf -i --force
	dh_auto_configure -- $(WITH_KAKDU)

override_dh_clean-arch:
	rm -rf fcgi

override_dh_install-arch:
	dh_install src/iipsrv.fcgi usr/lib/iipimage-server/
	dh_install debian/iipsrv.conf etc/apache2/mods-available
	dh_install debian/iipsrv.load etc/apache2/mods-available

override_dh_auto_install:
	# for some reason it install fcgi headers

override_dh_clean-indep:
	dh_clean doc/html/*

# Let's be smart with building doc
override_dh_auto_build-indep:
	doxygen doc/doxygen-html.conf

# No tests needed for docs
override_dh_auto_test-indep:

ifneq (,$(KDU_ROOT))
override_dh_shlibdeps:
endif

get-orig-source:
	uscan --verbose --force-download
