#!/usr/bin/make -f

# The magic debhelper rule:
%:
	dh $@ # --with autoreconf


DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

# Build MPI version
ifneq (,$(findstring mpi,$(DEB_BUILD_OPTIONS)))
        COND_CC:= "CC=mpicc"
else
        COND_CC:=
endif

export SUPPLIBS=/usr

override_dh_auto_clean:
	# Remove stuff added from tarballs
	rm -f doc/model.* doc/sample
	# rm -f data/font* data/mres data/lowres data/hires data/udunits.dat
	
override_dh_auto_configure:
	autoreconf -fiv
	dh_auto_configure -- $(COND_CC) \
		--enable-dyn-supplibs --with-gui  --with-readline --with-printim --with-x \
		--with-grib2 --with-netcdf --with-hdf5 -with-geotiff --with-sdf \
		 --with-hdf4-include=/usr/include/hdf --with-hdf4-libdir=/usr/lib \
		--with-gadap
	( cd data ; tar zxpf ../../grads_2.0.1.orig-data.tar.gz )
	( cd doc ; tar zxpf ../../grads_2.0.1.orig-example.tar.gz )

