#!/usr/bin/make -f
#export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEB_HOST_ARCH  := $(shell dpkg-architecture -qDEB_HOST_ARCH)

DOCS = yes
ifneq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
DOCS = no
endif
ifneq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
DOCS = no
endif

TESTS = yes
ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
TESTS = no
endif
ifneq (,$(filter nocheck,$(DEB_BUILD_PROFILES)))
TESTS = no
endif

%:
	dh $@ --with autoreconf


override_dh_auto_configure:
	dh_auto_configure -- --enable-drafts=no --with-docs=$(DOCS)

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_strip:
	dh_strip --dbg-package=libczmq-dbg

# unit tests are too unreliable on buildd, even i386.
# and on mips it seems to hang, so avoid running it.
override_dh_auto_test:
ifeq (yes,$(TESTS))
ifneq ($(DEB_HOST_ARCH),mips)
	-dh_auto_test -- VERBOSE=1
endif
endif
