#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/buildtools.mk
include /usr/share/dpkg/architecture.mk

ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
CONFIGURE_FLAGS = --=$(DEB_HOST_GNU_CPU)-$(DEB_HOST_ARCH_OS) CC=$(CC) CXX=$(CXX) AR=$(AR)
endif

export MAKE_OVERRIDE = V=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --with sphinxdoc

override_dh_auto_build:
	dh_auto_build -- $(MAKE_OVERRIDE)
	make -C doc html
	make -C doc latexpdf

# avoid package-name-defined-in-config-h lintian warning
# config.h is installed by default but is only needed during build
execute_before_dh_install:
	rm debian/tmp/usr/include/flint/config.h

override_dh_auto_test:
	dh_auto_test -- $(MAKE_OVERRIDE)

override_dh_auto_clean:
	dh_auto_clean
	rm -rf config.status libtool src/config.h src/flint.h doc/build
