#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto

# disable dbgsym package, release build-type doesn't generate debug symbols
export DEB_BUILD_OPTIONS=noddebs

export DEB_CFLAGS_MAINT_APPEND = -Wall \
				-Wno-unused-function -Wno-unused-variable \
				-Wno-unused-but-set-variable \
				-Wno-pedantic -Wno-comment \
				-Wno-array-parameter -Wno-strict-aliasing \
				-Wno-parentheses -Wno-unknown-pragmas \
				-Wno-missing-braces

# -Wdate-time is part of dpkg-buildflags
# remove it for now to suppress warning that will cause build error
export DEB_CPPFLAGS_MAINT_SET = $(filter-out -Wdate-time, $(shell dpkg-buildflags --get CPPFLAGS))

# force linker to not mark stack executable
# this will fix the lintian warning: executable-stack-in-shared-library
export DEB_LDFLAGS_MAINT_APPEND = -z noexecstack

include /usr/share/dpkg/buildflags.mk

%:
	dh ${@}

override_dh_auto_configure:
	dh_auto_configure -- \
		-DARCH=intel64 \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

override_dh_dwz:
	# disabled (fails with 'Unknown debugging section')
