#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
#export DH_OPTIONS=-v

#%:
#	dh  $@

# Use override_dh_* targets to customize this.
# ---------------------------------------------------

DEB_COMPRESS_EXCLUDE := ".docbook" 
DEB_BUILD_PARALLEL = 1
export DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/cmake.mk
# include /usr/share/cdbs/1/rules/simple-patchsys.mk
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

install/kdiff3::
	# install man page
	mkdir --parents $(DEB_DESTDIR)usr/share/man/man1
	docbook-to-man debian/kdiff3.sgml > $(DEB_DESTDIR)usr/share/man/man1/kdiff3.1
	# update gnome's icon cache
	dh_icons --package kdiff3 --tmpdir=debian/tmp

install/kdiff3-doc::
	# generate HTML help
	mkdir --parents $(DEB_DESTDIR)usr/share/doc/kdiff3-doc/html/
	cp doc/en/index.docbook $(DEB_DESTDIR)usr/share/doc/kdiff3-doc/html/
	# use UTF-8 for documentation generation, no matter the system's locale
	cd  $(DEB_DESTDIR)usr/share/doc/kdiff3-doc/html/ && LC_ALL=C.UTF-8 meinproc5 index.docbook
