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

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

export CC=/usr/bin/mpicc.$(ARCH_DEFAULT_MPI_IMPL)
export F77=/usr/bin/mpif77.$(ARCH_DEFAULT_MPI_IMPL)

%:
	dh $@ --with autotools_dev,autoreconf

override_dh_auto_clean:
	-(cd examples; $(MAKE) distclean)
	dh_auto_clean
	find $(CURDIR) -name "Makefile" | xargs rm -f

override_dh_auto_configure:
	dh_auto_configure -- 				\
		--disable-zlib				\
		--with-fetk-include=/usr/include 	\
		--with-fetk-library=/usr/lib		\
		--with-blas=-lblas			\
		--with-arpack=/usr/lib			\
		--with-$(ARCH_DEFAULT_MPI_IMPL)=/usr/lib/$(ARCH_DEFAULT_MPI_IMPL)

override_dh_auto_install:
	dh_auto_install -- DESTDIR=$(CURDIR)/debian/tmp

override_dh_auto_test:
	-$(MAKE) -C $(CURDIR)/examples/ quicktest APBS=$(CURDIR)/bin/apbs APBSBIN=$(CURDIR)/bin/apbs

override_dh_install:
	dh_install --sourcedir=$(CURDIR)/debian/tmp --list-missing

override_dh_installchangelogs:
	dh_installchangelogs ChangeLog

.NOTPARALLEL:
