#!/usr/bin/make -f
# -*- makefile -*-

export DPKG_GENSYMBOLS_CHECK_LEVEL=4

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

ifneq (,$(filter $(DEB_HOST_ARCH),s390x powerpc))
        ENABLE_TESTS = OFF
else
        ENABLE_TESTS = ON
endif

include /usr/share/dpkg/default.mk

# Add migrations add-on when build on Ubuntu where the original name is available.
DH_MIGRATIONS = $(shell dpkg-vendor --derives-from Ubuntu && echo "--with migrations")

%:
	dh $@ $(DH_MIGRATIONS)

override_dh_auto_configure:
	dh_auto_configure -- -DENABLE_TESTS=${ENABLE_TESTS}

override_dh_install:
	sed -i debian/tmp/usr/share/doc/libusermetrics-doc/html/* -e "s,$(CURDIR)/,,g"
	sed -i debian/tmp/usr/share/doc/libusermetrics-doc/xml/* -e "s,$(CURDIR)/,,g"
	dh_install
