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

# Set SOURCE_DATE_EPOCH
include /usr/share/dpkg/default.mk
HG_VARS = "HG= HG_CMD= HG_ID= HG_TIMESTAMP=$(SOURCE_DATE_EPOCH)"

export QHELPGENERATOR = /usr/lib/qt6/libexec/qhelpgenerator

# Exclude unit test from funm.m for Octave >= 11.1.0
OCTAVE_VERSION=$(shell octave-cli --help | head -n1 | sed 's/.*version//')
ifeq (true,$(shell dpkg --compare-versions $(OCTAVE_VERSION) ge 11.1.0 && echo true))
export DH_OCTAVE_EXCLUDE_TEST = funm.m
endif

foo:
	echo $$DH_OCTAVE_EXCLUDE_TEST

%:
	dh $@ --buildsystem=octave

ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
override_dh_auto_build:
	make -C doc doc $(HG_VARS)
endif

execute_after_dh_clean:
	make -C doc clean-docs $(HG_VARS)
