#!/usr/bin/make -f
#export DH_VERBOSE=1

%:
	dh $@ --buildsystem=cmake

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

CMAKE_EXTRA_FLAGS += -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
 -DUSE_FPIC:BOOL=ON \
 -DCMINPACK_LIB_INSTALL_DIR:STRING=lib/$(DEB_HOST_MULTIARCH) \
 -DBUILD_SHARED_LIBS:BOOL=ON \
 -DBUILD_EXAMPLES:BOOL=OFF

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_EXTRA_FLAGS)

override_dh_auto_test:
ifeq ($(filter $(DEB_BUILD_OPTIONS),nocheck),)
	$(MAKE) -C examples ctest
else
	@echo '"DEB_BUILD_OPTIONS" has "nocheck". Skipping tests'
endif

override_dh_clean:
	dh_clean
	$(MAKE) -C examples clean

get-orig-source:
	uscan --verbose --force-download --repack --rename
