#!/usr/bin/make -f

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

ifeq (s390x,$(DEB_HOST_ARCH))
export CC = gcc-6
endif

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

CFLAGS := $(subst -O2,-O3,$(CFLAGS))

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

%:
	dh $@ --with autoreconf --builddirectory=_build --parallel

override_dh_auto_configure:
	dh_auto_configure -- --enable-shared --enable-maintainer-mode

override_dh_auto_build-indep:
	true

override_dh_auto_test-indep:
	true

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

override_dh_installdocs:
	dh_installdocs -plibecm1-dev --link-doc=libecm1-dev-common
	dh_installdocs --remaining-packages

override_dh_compress-indep:
	dh_compress -Xexamples

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