#!/usr/bin/make -f

export DH_VERBOSE=1

BUILDDIR=debian/build
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# The magic debhelper  rule
%:
	dh $@ --builddirectory=$(BUILDDIR) --buildsystem=cmake

override_dh_auto_clean:
	dh_clean
	rm -fr $(BUILDDIR)

# -DWITH_XEUS=yes for Jupyter kernel support
# not currently compiling ?

override_dh_auto_configure:
	mkdir -p $(BUILDDIR)
	dh_auto_configure --  \
		-DCMAKE_BUILD_TYPE=Debug \
		-DWITH_JSON=yes \
		-DWITH_FMT=yes \
		-DWITH_BFD=yes	\
		-DWITH_LLVM=yes \
		-DLLVM_DIR=/usr/lib/llvm-16/cmake \
		-DWITH_RUNTIME_STACKTRACE=yes \
		-DWITH_STACKTRACE=yes \
		-DWITH_KOKKOS=no \
		-DCMAKE_Fortran_MODULE_DIRECTORY=/usr/lib/$(DEB_HOST_MULTIARCH)/fortran/lfortran-mod-0


override_dh_gencontrol:
	dh_gencontrol -- -VBuilt-Using="`dpkg-query -f'$${source:Package} (= $${source:Version}), ' -W binutils-dev libiberty-dev`"

override_dh_auto_test:
	@echo Bypass tests on this build
