#! /usr/bin/make -f
BUILDDIR = debian/build

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

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
extra_flags += -DEIGEN_BUILD_TESTS=ON
endif

override_dh_auto_configure:
	dh_auto_configure -- $(extra_flags)

override_dh_installchangelogs:
	dh_installchangelogs debian/Changelog_upstream

override_dh_auto_test:
	echo -- Running tests. Even if one of them fails the build is not canceled.
	-cat /proc/meminfo
	-cat /proc/cpuinfo
	dh_auto_test -- ARGS=-VV || true

override_dh_auto_build:
	dh_auto_build
ifneq (,$(findstring libeigen2-doc, $(shell dh_listpackages)))
	if [ -n "`which doxygen`" ]; then dh_auto_build -- doc; fi
endif
