#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk

# output every command that modifies files on the build system.
#DH_VERBOSE = 1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

CMAKE_ADDTIONAL_FLAGS ?=
ifneq ($(DEB_HOST_ARCH_CPU),amd64)
CMAKE_ADDITIONAL_FLAGS ?= -DUSE_INTRINSICS_SSE=OFF
endif

%:
	dh $@ --sourcedirectory=Sources

override_dh_auto_configure:
	find . -name "CMakeLists.txt" -exec sed -i 's/-march=native) # set mtune=generic/-mtune=generic) # set mtune=generic/g' {} +
	dh_auto_configure -- -G "Unix Makefiles" \
	 -DTFE=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) \
	 $(CMAKE_ADDITIONAL_FLAGS)
