#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
export DEB_CXXFLAGS_MAINT_APPEND  = -Wall -pedantic

# trust upstream optimization level unless explicitly disabled
ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
export DEB_CFLAGS_MAINT_STRIP=-O2
export DEB_CXXFLAGS_MAINT_STRIP=-O2
endif

UNICODE_REGENERATE_TABLES=true

# re-apply most upstream patched-out optimizations

%:
	dh $@

# avoid optimization on weak arches to not run out of memory
override_dh_auto_test:
ifneq (,$(filter $(DEB_HOST_ARCH),armel armhf i386 mips64el powerpc riscv64))
	DEB_BUILD_OPTIONS=noopt dh_auto_test --buildsystem rust
else
	dh_auto_test --buildsystem rust
endif
