#!/usr/bin/make -f
# -*- makefile -*-

# get octave paths (have to build-depend on octave-headers)
include /usr/share/octave/debian/defs.make
# same for Matlab
include /usr/share/matlab/debian/defs.make

# one ring to rule them all ...
%:
	dh $@

override_dh_auto_build:
	./build -verbose -debug -system=linux
	# build icon
	convert icons/mrtrix.xpm -resize 32x32 mrtrix.xpm

override_dh_auto_install:
	dh_auto_install
	cp debian/mrtrix.links.in debian/mrtrix.links
	echo "/usr/share/mrtrix/matlab $(MATLAB_MDIR)/mrtrix" >> debian/mrtrix.links
	echo "/usr/share/mrtrix/matlab $(MDIR)/mrtrix" >> debian/mrtrix.links

# we want immediately useable docs and example data, they are in a dedicated
# package already
override_dh_compress:
	dh_compress -X.html

override_dh_clean:
	./build -system=linux clean
	find . -name '*.pyc' -delete
	-rm mrtrix.xpm
	dh_clean
	@rm -f debian/mrtrix.links

override_dh_shlibdeps:
	dh_shlibdeps -l $(CURDIR)/lib
