#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

# Use libopenlibm on architectures that have it
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 i386 arm64 armhf mips mips64el mipsel powerpc ppc64 ppc64el hurd-i386 kfreebsd-amd64 kfreebsd-i386 x32))
BUILD_FLAGS += USE_OPENLIBM=1
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

# Avoid useless library dependencies
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
	dh $@ --parallel

override_dh_auto_build:
	dh_auto_build -- prefix=/usr CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" FFLAGS="$(FFLAGS)" $(BUILD_FLAGS)
