#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all noparallel
include /usr/share/dpkg/architecture.mk
DPKG_EXPORT_BUILDTOOLS=1
include /usr/share/dpkg/buildtools.mk

# set installation prefix
export PREFIX=/usr/

# some archs require turning of some optimizations
NOEXPOPT_ARCHS=

# turn off hanging tests on i386
ifeq ($(DEB_BUILD_ARCH), i386)
export ODE_SIMU_OFF=1
endif

ifneq (,$(filter $(NOEXPOPT_ARCHS), $(DEB_BUILD_ARCH)))
export DEB_CFLAGS_MAINT_APPEND = -fno-expensive-optimizations
endif

# Some tests fail on the following architectures probably
# due to minor differences in floating point processing.
# For now, just turn it off...
NOTEST_ARCHS=i386

# For this architesture the test will be run but it will pass in any case even when errors occure
PRINT_ERRORS_WHEN_TESTING=sh4 arc m68k alpha

%:
	dh $@

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
ifeq (,$(filter $(NOTEST_ARCHS), $(DEB_BUILD_ARCH)))
ifeq (,$(filter $(PRINT_ERRORS_WHEN_TESTING), $(DEB_BUILD_ARCH)))
	make utest
else
	# the test will be run but its passing in any case
	make utest || true
endif
endif
endif
