#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

MAKE_OVERRIDE = AT= QUIET_CXX= QUIET_CC= QUIET_AR= ABI_FLAG='$(LDFLAGS) $(CPPFLAGS) $(CFLAGS)'

%:
	dh $@

# upstream Makefile has only CFLAGS, not CPPFLAGS and not even CXXFLAGS, so
# inject flags using configure. let's hope CFLAGS will always be good enough
# even for $(CXX)
override_dh_auto_configure:
	./configure --prefix=/usr --disable-static --with-flint=/usr CFLAGS='$(CPPFLAGS) $(CFLAGS)'
	sed -i Makefile -e "s/libarb/libflint-arb/g"
	sed -i Makefile -e "s/-larb/-lflint-arb/g"

override_dh_auto_build:
	dh_auto_build -- $(MAKE_OVERRIDE)

override_dh_auto_test:
	dh_auto_test -- $(MAKE_OVERRIDE)
