#!/usr/bin/make -f

# Cmake doesn't use CPPFLAGS by default.
CFLAGS += $(CPPFLAGS)
CXXFLAGS += $(CPPFLAGS)

# Disable debug output, which is very noisy.
# (#329109 and (after upstream moved to cmake and the fix was lost) #603871)
CXXFLAGS += -DNDEBUG

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_CXX_FLAGS="$(CXXFLAGS)"

override_dh_auto_test:
	dh_auto_test
	cp tests/*.doc obj-*/tests
	cd obj-*/tests ; for t in *test ; do \
	  echo "Running test $$t" ;\
	  if [ $$t = handlertest ]; then \
	    set -e ; ./$$t testole.doc ;\
	  else \
	    set -e ; ./$$t ;\
	  fi \
	done
