#!/usr/bin/make -f
# -*- makefile -*-

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

SKIP_TESTS=long
#internal compiler not working yet
SKIP_TESTS+=compile
#poco feature unsuported in current debian release
SKIP_TESTS+=00416
#base64
SKIP_TESTS+=00732
#flaky test
SKIP_TESTS+=00417

#tests affected by SSE disable
SKIP_TESTS+=00120 00161 00212 00232 00273 00284 00506 00647 00704 00720 00800

export TEST_OPT=--skip ${SKIP_TESTS}

ifdef DH_VERBOSE
	TEST_ARGS=--verbose
endif

CMAKE_FLAGS = -DUNBUNDLED=1 -DUSE_STATIC_LIBRARIES=0 USE_UNWIND=0 -DCLICKHOUSE_SPLIT_BINARY=1 -DVERSION_DESCRIBE=$(shell dpkg-parsechangelog -S Version)

CMAKE_FLAGS+=-DENABLE_IPO=1

%:
	dh $@  --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_FLAGS)

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_test -- ARGS+=$(TEST_ARGS)
endif
