#! /usr/bin/make -f
BUILDDIR = $(CURDIR)/debian/build

%:
	dh $@ --buildsystem=cmake --builddirectory=$(BUILDDIR) --parallel

export DEB_BUILD_MAINT_OPTIONS := hardening=+all

disable_auto_test_archs = mips mipsel armel armhf

override_dh_auto_configure:
	dh_auto_configure -- -DDART_TESTING_TIMEOUT=300

override_dh_installchangelogs:
	dh_installchangelogs debian/Changelog_upstream

override_dh_auto_test:
ifeq (,$(filter $(DEB_HOST_ARCH),$(disable_auto_test_archs)))
	echo -- Running tests. Even if one of them fails the build is not canceled.
	-cat /proc/meminfo
	-cat /proc/cpuinfo
	cd $(BUILDDIR); $(MAKE) buildtests
	dh_auto_test -- ARGS=-VV || true
endif

override_dh_auto_build-indep:
	cd $(BUILDDIR); $(MAKE) doc
	rm -f $(BUILDDIR)/doc/html/unsupported/installdox
