#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE = 1

BUILD_OPTIONS = -DCMAKE_INSTALL_LIBDIR="lib"

ifeq (,$(findstring nocheck,$(DEB_BUILD_PROFILES)))
BUILD_OPTIONS += -DBUILD_TESTS=ON \
		 -DGTEST_SRC_DIR="/usr/src/googletest"
else
BUILD_OPTIONS += -DBUILD_TESTS=OFF
endif

%:
	dh $@ --with sphinxdoc

override_dh_auto_clean:
	dh_auto_clean
ifeq (,$(findstring nodoc,$(DEB_BUILD_PROFILES)))
	$(MAKE) -C docs clean
endif

override_dh_auto_configure:
	dh_auto_configure -- $(BUILD_OPTIONS)

override_dh_auto_build:
	dh_auto_build
ifeq (,$(findstring nodoc,$(DEB_BUILD_PROFILES)))
	$(MAKE) -C docs html
endif

override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_PROFILES)))
	dh_auto_test -- xtest
endif

override_dh_auto_install:
	dh_auto_install --destdir=debian/tmp

get-orig-source:
	uscan --download-current-version --force-download --no-symlink
