#!/usr/bin/make -f

#export DH_VERBOSE=1

include /usr/share/dpkg/pkg-info.mk
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)
DESTDIR=$(CURDIR)/debian/tmp
CMAKEDIR:=$(DESTDIR)/$(LIBDIR)/cmake/metkit

# The magic debhelper  rule
%:
	dh $@ --buildsystem=ecbuild

CMAKE_CFLAGS:= -DENABLE_RPATH=OFF \
		-DENABLE_ODB=$(DO_ODB) \
		-DENABLE_RELATIVE_RPATHS=OFF

override_dh_auto_configure:
	dh_auto_configure -- \
                      ${BUILD_FLAGS} 

override_dh_auto_install:
	dh_auto_install
	sed -i -e 's%$${_IMPORT_PREFIX}/include%/usr/include/${DEB_HOST_MULTIARCH}%g'   $(CMAKEDIR)/metkit-targets.cmake

override_dh_auto_test:
	echo "Metkit fetches data from the internet, and hence the tests can't be run contained at build-time"
