#!/usr/bin/make -f

# disable dbgsym package
# as in release mode, ipp-crypto does not generate debug symbols
export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto noautodbgsym

export DEB_CFLAGS_MAINT_APPEND = -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
# remote 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

DPKG_EXPORT_BUILDFLAGS = 1

include /usr/share/dpkg/buildflags.mk

%:
	dh $@

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

override_dh_strip:
	dh_strip --no-automatic-dbgsym

# dwz output error :
# debian/libipp-crypto11/usr/lib/x86_64-linux-gnu/libcrypto_mb.so.11.9: Unknown debugging section .debug_addr
# skip this target for now
override_dh_dwz:
	: