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

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

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

export FFLAGS=$(shell dpkg-buildflags --get FFLAGS) -fno-expensive-optimizations

%:
	dh $@ --buildsystem=cmake --with sphinxdoc

override_dh_auto_configure:
	dh_auto_configure --		\
		-DTOOLS=ON		\
		-DOPENMP=ON		\
		-DLINALG=OpenBLAS	\
		-DOPENBLASROOT=/usr/include/${DEB_HOST_MULTIARCH}/openblas64-openmp \
		-DCMAKE_SKIP_RPATH=ON

override_dh_auto_build:
	#(cd obj-*; $(MAKE) doc_html)
	dh_auto_build

override_dh_auto_install:
	dh_auto_install
	cp obj-*/Tools/pymolcas/pymolcas_ debian/tmp/usr/bin/pymolcas
	cp -a test debian/tmp/usr/share/openmolcas
