#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

ifneq ($(wildcard /usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial/libhdf5.so),)
  WITH_HDF5:=--with-hdf5=/usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial
else
  WITH_HDF5:=--with-hdf5
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(WITH_HDF5)

override_dh_auto_build:
	dh_auto_build
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	make -C documentation pdf
endif

override_dh_makeshlibs:
	dh_makeshlibs -V

override_dh_auto_clean:
	dh_auto_clean
	rm -f documentation/matio_user_guide.pdf test/atconfig test/package.m4 test/testsuite
	rm -rf documentation/matio_user_guide.t2p/

override_dh_compress:
	dh_compress -X.pdf
