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

%:
	dh $@ --with autotools_dev

override_dh_auto_clean:
	-(cd src/bin/mpqc/validate; $(MAKE) check_clean)
	dh_auto_clean

override_dh_auto_configure:
	dh_auto_configure -- \
		--enable-production \
		--with-cxx=mpic++\
		--with-cc=mpicc \
		--with-f77=mpif77 \
		--enable-threads \
		--enable-always-use-mpi \
		--with-default-parallel=mpi \
		--with-mpi-thread=single \
		--enable-shared \
		--includedir=/usr/include/sc \
		--datadir=/usr/share/mpqc \
		--with-sc-datadir=/usr/share/mpqc \
		--with-include=-I/usr/include/mpi

override_dh_auto_install:
	dh_auto_install -- install install_devel installroot=$(CURDIR)/debian/tmp
	chrpath -d $(CURDIR)/debian/tmp/usr/lib/*.so.*.*.*
	chrpath -d $(CURDIR)/debian/tmp/usr/bin/mpqc
	chrpath -d $(CURDIR)/debian/tmp/usr/bin/scls
	chrpath -d $(CURDIR)/debian/tmp/usr/bin/scpr
	chrpath -d $(CURDIR)/debian/tmp/usr/bin/molrender

override_dh_install:
	dh_install --list-missing
	chmod a-x debian/mpqc-support/usr/share/mpqc/validate/*

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
	-dh_auto_test -- -C src/bin/mpqc/validate check SCLIBDIR=$(CURDIR)/lib OMPI_MCA_plm_rsh_agent=/bin/false
endif

.NOTPARALLEL:
