#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

DEB_CMAKE_EXTRA_FLAGS = -Dracon_build_tests=ON -Dracon_build_wrapper=ON

ifneq (,$(filter $(DEB_HOST_ARCH), i386))
	export DEB_CXXFLAGS_MAINT_APPEND += -ffloat-store
endif

%:
	dh $@ --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure -- $(DEB_CMAKE_EXTRA_FLAGS)
	# Somehow the means in the patch for CMakeLists.txt to replace -lpthread by -pthread to not work
	# Just hack it here
	sed -i 's/-lpthread/-pthread/' obj-*/CMakeFiles/racon_test.dir/link.txt

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd test && ../obj-*/bin/racon_test
endif
