#!/usr/bin/make -f
# Copyright 2009 Sylvestre Ledru <sylvestre@debian.org>

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/autoreconf.mk

# Which MPI implementation?
# set ARCH_DEFAULT_MPI_IMPL
include /usr/share/mpi-default-dev/debian_defaults

DEB_CONFIGURE_USER_FLAGS := --with-syrthes=/usr/lib/syrthes/ --with-mpi  --libexecdir=/usr/lib/

ifneq ($(wildcard /usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/$(ARCH_DEFAULT_MPI_IMPL)/libhdf5.so),)
  DEB_CONFIGURE_USER_FLAGS += \
	--with-hdf5-include=/usr/include/hdf5/$(ARCH_DEFAULT_MPI_IMPL) \
	--with-hdf5-lib=/usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/$(ARCH_DEFAULT_MPI_IMPL)
endif

#--libdir=/usr/lib/code_saturne
DEB_MAKE_BUILD_TARGET    := all
DEB_MAKE_INSTALL_TARGET  := install DESTDIR=`pwd`/debian/tmp
DEB_COMPRESS_EXCLUDE := .pdf .xml .des .f90 .c

install/code-saturne-bin::
	chrpath -d debian/tmp/usr/lib/code_saturne/cs_*

binary-install/code-saturne-data::
	chmod +x debian/code-saturne-data/usr/share/code_saturne/runcase*
	dh_python2 -pcode-saturne-data
