#!/usr/bin/make -f

#export DH_VERBOSE=1

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk

ARCH:=$(shell dpkg --print-architecture)
LIBDIR:=/usr/lib/${DEB_HOST_MULTIARCH}
DESTDIR:=$(CURDIR)/debian/tmp

ARCH_PMEM:= amd64 arm64 ppc64el
DO_PMEM:= $(if $(filter $(DEB_TARGET_ARCH), $(ARCH_PMEM)),ON,OFF)

ARCH_NORADOS:= hurd-i386 kfreebsd-amd64 kfreebsd-i386 sh4 ia64 alpha hppa
DO_RADOS:= $(if $(filter $(DEB_TARGET_ARCH), $(ARCH_NORADOS)),OFF,ON)

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


CMAKE_CFLAGS:=  -DENABLE_RPATHS=OFF \
		-DENABLE_RELATIVE_RPATHS=OFF \
		-DENABLE_PMEMFDB=$(SO_PMEM)  \
		-DENABLE_RADOSFDB=$(DO_RADOS) \
		-DENABLE_LUSTRE=ON 

override_dh_auto_configure:
	dh_auto_configure -- \
                      ${BUILD_FLAGS}


override_dh_auto_test:
	@echo "Ignoring test failures in this build"
	dh_auto_test ||  echo "Ignoring test failures" 

override_dh_auto_install:
	dh_auto_install	
