#!/usr/bin/make -f

# Comment out this line for debugging
#export DH_VERBOSE:=1

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

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH)


# Disable checks: known bad test case ignored this release
DEB_CONFIGURE_EXTRA_FLAGS :=  --enable-shared --with-pic
DEB_CONFIGURE_SCRIPT_ENV += \

override_dh_configure:
	dh_configure --  --enable-shared --with-pic  \
    		CFLAGS="-D_HDFEOS5_THREADSAFE" CPPFLAGS="-Df2cFortran -I/usr/include/hdf"
	# Needed for the pthreads tests
	cp  samples/simple.txt testdrivers/threads

override_dh_auto_test:
	echo "Tests disabled in this version - known ok failures" 


override_dh_auto_install:
	dh_auto_install
	mkdir -p debian/libhe5-hdfeos-dev/${LIBDIR}/pkgconfig debian/libhe5-hdfeos0/${LIBDIR}
	mv hdf-eos5.pc debian/libhe5-hdfeos-dev/${LIBDIR}/pkgconfig
	mv debian/tmp/${LIBDIR}/libhe5_hdfeos.so.0.0.0  debian/libhe5-hdfeos0/${LIBDIR}
	cp debian/tmp/usr/lib/*/*.a debian/libhe5-hdfeos-dev/${LIBDIR}
	cp -a samples/* debian/libhe5-hdfeos-dev/usr/share/doc/libhe5-hdfeos-dev/examples
	chmod -x debian/libhe5-hdfeos-dev/usr/share/doc/libhe5-hdfeos-dev/examples/*
	dh_link -p libhe5-hdfeos-dev ${LIBDIR}/libhe5_hdfeos.so.0.0.0 ${LIBDIR}/libhe5_hdfeos.so
	dh_link -p libhe5-hdfeos0   ${LIBDIR}/libhe5_hdfeos.so.0.0.0 ${LIBDIR}/libhe5_hdfeos.so.0
		

#install/libhe5-hdfeos0::
	
