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

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

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

export TOP_SRCDIR=$(CURDIR)

## At the time of coding, GOMP emits random `Bus error' during test on mipsel
## architecture machines --- see bugreport #806769 for further information.
## -- Jerome Benoit <calculus@rezozer.net>  Tue, 01 Dec 2015
ifeq (mipsel-linux-gnu,$(DEB_HOST_MULTIARCH))
DEB_PKG_NMZ_OPENMP=no
else
DEB_PKG_NMZ_OPENMP=yes
endif

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

%:
	dh $@ --builddirectory=_build

override_dh_auto_configure:
	dh_auto_configure -- --enable-openmp=$(DEB_PKG_NMZ_OPENMP)

override_dh_auto_build-indep:

override_dh_auto_build-arch:
	dh_auto_build -a

override_dh_auto_test-indep:

override_dh_prep-arch:
	$(MAKE) -f debian/adhoc/Makefile manpages

override_dh_auto_install-indep:
	$(MAKE) -C _build/source install-data-am DESTDIR=$(CURDIR)/debian/tmp

override_dh_compress-indep:
	dh_compress -X.pdf -Xexamples

get-orig-source:
	uscan --no-conf --download-current-version --verbose
