#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEB_HOST_MULTIARCH  ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

include /usr/share/mpi-default-dev/debian_defaults

ifeq ($(ARCH_DEFAULT_MPI_IMPL),openmpi)
OPENMPI=yes
else
OPENMPI=no
endif

CONFIGURE_ENV=CUPTI_ROOT=/usr
CONFIGURE=--with-cuda=/usr --with-litl=/usr --with-gtg=/usr --with-starpu=/usr

#export NVCCFLAGS = "-ccbin clang-3.8"
export NVCCFLAGS = "-ccbin gcc-6"

%:
	dh $@ --parallel --with autoreconf

override_dh_auto_configure:
	$(CONFIGURE_ENV) dh_auto_configure -Bbuild-mpich -- $(CONFIGURE) --with-mpi-include=/usr/include/mpich --with-mpi-module-name=mpich --with-mpi-event-id=4

override_dh_auto_build:
	dh_auto_build -Bbuild-mpich -- -C src/modules/cuda

override_dh_auto_clean:
	dh_auto_clean -Bbuild-mpich -- -C src/modules/cuda
	rm -f test/automake/testcommon.h

override_dh_auto_install:
	dh_auto_install --destdir=debian/tmp -Bbuild-mpich -- -C src/modules/cuda

override_dh_auto_test:
	-dh_auto_test --no-parallel -Bbuild-mpich -- -C src/modules/cuda -k

override_dh_strip:
	dh_strip -Xlibeztrace-autostart-
