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

export DEB_BUILD_MAINT_OPTIONS  = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
	dh $@

ifeq ($(DEB_HOST_ARCH),riscv64)
CONF_ARCH := -DTESTS_USE_VALGRIND=OFF
endif
override_dh_auto_configure:
	@printf 'nproc: %d (out of %d)\n' `nproc` `nproc --all`
	free
	df -h
	stat -f .
	dh_auto_configure -- -DCMAKE_BUILD_TYPE=RelWithDebInfo $(CONF_ARCH)

# Tests for concurrent hashmap are currently not concurrent.
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd obj-$(DEB_HOST_GNU_TYPE) && PMEM_IS_PMEM_FORCE=1 ctest --output-on-failure \
		-j1 -E 'vcmap__concurrent_put_get_remove_.*'
endif
