#! /usr/bin/make -f

ARCH  = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

CMAKE_FLAGS =


# Tests are buggy; disable test on sparc
ifeq ($(ARCH),sparc)
	DEB_BUILD_OPTIONS += nocheck
endif

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



%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_FLAGS)

override_dh_install:
	cd debian/minc-tools && mkdir -p usr/share && mv usr/man usr/share
	dh_link /usr/share/man/man1/voxeltoworld.1 \
		/usr/share/man/man1/worldtovoxel.1
