#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

export DEB_CFLAGS_MAINT_APPEND=-D_FORTIFY_SOURCE=2
export DEB_CFLAGS_MAINT_STRIP=-D_FORTIFY_SOURCE=3

## inspired from mpfr material
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else ifeq ($(DEB_HOST_ARCH), alpha)
	CFLAGS += -mieee
else ifeq ($(DEB_HOST_ARCH),sha4)
	CFLAGS += -mieee
else
	CFLAGS := $(subst -O2,-O3,$(CFLAGS))
endif

export ACLOCAL_PATH=/usr/share/gnulib/m4

default:
	@uscan --no-conf --dehs --report || true

%:
	dh $@ --builddirectory=_build

override_dh_auto_configure:
	dh_auto_configure -- \
		--includedir=/usr/include/$(DEB_HOST_MULTIARCH) \
		--enable-maintainer-mode

override_dh_auto_build-indep:
	$(MAKE) -C _build/docs doc

override_dh_auto_test-indep:

override_dh_auto_install-indep:

override_dh_compress-indep:
	dh_compress -X.pdf -Xexamples

override_dh_missing:
	dh_missing -X.la
