#!/usr/bin/make -f

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

CFLAGS		:= $(shell dpkg-buildflags --get CFLAGS)
CPPFLAGS	:= $(shell dpkg-buildflags --get CPPFLAGS)
CXXFLAGS	:= $(shell dpkg-buildflags --get CXXFLAGS)
LDFLAGS		:= $(shell dpkg-buildflags --get LDFLAGS)

export CFLAGS CPPFLAGS CXXFLAGS LDFLAGS

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

override_dh_auto_configure:
	dh_auto_configure -- --with-gmp --enable-shared \
		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH)

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

override_dh_auto_build-indep:
	#mkdir -p docs/givaro-dev-html
	#$(MAKE) -C docs docs_dev
	$(MAKE) docs
	rm -f docs/givaro-*html/COPYING
	rm -f docs/givaro-*html/INSTALL

override_dh_auto_test:
	dh_auto_test --max-parallel=1

dhopts :=

ifneq (hurd-i386,$(shell dpkg-architecture -qDEB_BUILD_ARCH))
dhopts := --parallel
endif

%:
	dh $@ --with autoreconf $(dhopts)
