#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

ENABLE_DOC := $(if $(shell dh_listpackages -i),--enable-doc)

override_dh_auto_configure:
	dh_auto_configure -- $(ENABLE_DOC) --without-archnative

# the default value of USE_TARGETS is "docs", but this builds the
# documentation a second time
override_dh_auto_install:
	dh_auto_install -- USE_TARGETS=

override_dh_installexamples:
	dh_installexamples -XMakefile -XMakefile.am -XMakefile.in

# remove build path from givaro-makefile
execute_after_dh_install-arch:
	sed -i 's/-ffile-prefix-map=[^ ]*//' \
		debian/libgivaro-dev/usr/share/givaro/givaro-makefile

override_dh_auto_test:
	dh_auto_test --max-parallel=1

HTML_DIR = debian/libgivaro-doc/usr/share/doc/libgivaro-dev/givaro-html

execute_after_dh_installdocs-indep:
	dh_doxygen
	rm -f $(HTML_DIR)/COPYING $(HTML_DIR)/INSTALL

# fix "duplicate-files" Lintian warning
execute_before_dh_link-indep:
	jdupes -rl $(HTML_DIR)

%:
	dh $@
