#!/usr/bin/make -f

# export DH_VERBOSE=1

ifneq ($(wildcard /usr/lib/$(DEB_HOST_MULTIARCH)/hdf5/serial/libhdf5.so),)
  export DEB_CXXFLAGS_MAINT_APPEND := -I/usr/include/hdf5/serial
endif

%:
	dh $@ --parallel

override_dh_auto_build:
	dh_auto_build
	@echo building PDF reference manual
	cd obj-*/doc/latex && \
	 sed --in-place 's:usepackage\[utf8\]{inputenc}:usepackage[utf8x]{inputenc}:' refman.tex && \
	 $(MAKE) pdf

override_dh_auto_test:
	@echo do not ask do not tell do not test

override_dh_install:
	dh_install
	for d in				\
	  debian/mlpack-bin/usr/bin		\
	  debian/mlpack-bin/usr/share/man/man1;	\
	do					\
	  (cd $$d &&				\
	  for f in *; do			\
	    mv --verbose $${f} mlpack_$${f};	\
	  done);				\
	done

override_dh_compress:
	dh_compress -Xrefman.pdf -Xdoc/html/
