#!/usr/bin/make -f

# DH_VERBOSE=1
NUMJOBS=$(filter parallel=%,$(DEB_BUILD_OPTIONS))
SCONSPARFLAGS=$(subst parallel=,-j, $(NUMJOBS))

export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

export CXXFLAGS+=-std=c++98
# workaround for https://github.com/BRiAl/BRiAl/issues/11

%:
	dh $@ --parallel --with autoreconf --with python2

override_dh_strip:
	dh_strip -plibbrial0 \
	  --dbg-package=libbrial0-dbg
	dh_strip -plibbrial-groebner0 \
	  --dbg-package=libbrial-groebner0-dbg
	dh_strip -a -Nlibbrial0 \
	  -Nlibbrial-groebner0

override_dh_auto_test:
	scons $(SCONSPARFLAGS) testsuite/unittests
ifeq ($(DEB_HOST_ARCH_OS),hurd) # problems with rpath on hurd
	LD_LIBRARY_PATH=$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) testsuite/unittests
else
	testsuite/unittests
endif
