#!/usr/bin/make -f

include /usr/share/octave/debian/defs.make

%:
	dh $@ --with sphinxdoc,elpa

# Disable multi-arch path
override_dh_auto_configure:
	dh_auto_configure -- --disable-matlab --libdir=/usr/lib

override_dh_auto_build:
# Also build PDF and HTML docs (unless nodoc is given)
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	dh_auto_build -- all pdf html
else
	dh_auto_build
endif

# Don't run the testsuite
override_dh_auto_test:

# Needed for "make distclean" (since we disabled MATLAB at configure level)
execute_before_dh_auto_clean:
	-[ -f Makefile ] && echo -e "distclean:\n\t-rm -f Makefile" > mex/build/matlab/Makefile

execute_after_dh_installdocs-indep:
	cp -dR doc/manual/build/html/ debian/dynare-doc/usr/share/doc/dynare/dynare.html

override_dh_link:
	dh_link --package=dynare /usr/lib/dynare/matlab/dynare.m $(MDIR)/dynare.m

# Generate a versioned dependency on octave.
# This is to avoid the situation where the dependency on liboctaveNN is
# satisfied, but does not correspond to the version of octave installed.
execute_before_dh_gencontrol:
	dh_octave_substvar
