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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@ 

# No ibverbs support available on kFreeBSD, Hurd
NO_VERBS_ARCH:= kfreebsd-amd64 hurd-amd64 s390x
NO_JAVA_ARCH:= ia64
NO_NUMA_ARCH:= kfreebsd-amd64

VERBS:=   $(if $(filter $(DEB_TARGET_ARCH), $(NO_VERBS_ARCH)), , --with-verbs )
NUMA:=   $(if $(filter $(DEB_TARGET_ARCH), $(NO_NUMA_ARCH)),  --disable-numa , )
ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
       JAVA := $(if $(filter $(DEB_TARGET_ARCH), $(NO_JAVA_ARCH)), \
                 ,--with-jdk-dir=/usr/lib/jvm/default-java --with-java=/usr/lib/jvm/default-java )
endif

override_dh_auto_configure:
	CPPFLAGS="-I/usr/include/hsa -I/usr/include/hip" dh_auto_configure --  \
		--enable-mt \
		$(VERBS) \
		$(NUMA) \
		--with-go=no \
		--with-mad=yes \
		--enable-backtrace-detail \
		--enable-logging \
		--enable-devel-headers \
		--enable-examples \
		--enable-cma \
		--enable-lcov \
		--enable-profiling \
               --enable-rc \
               --enable-dc \
               --enable-ud \
               --with-mlx5-dv \
               --enable-dm

override_dh_auto_clean:
	dh_auto_clean
	find  . -type l -delete
	rm -f config.log

override_dh_shlibdeps:
	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info

