#!/usr/bin/make -f
# -*- makefile -*-

DH_VERBOSE=1

export DESTDIR=$(CURDIR)/debian/tmp
export LC_ALL=C.UTF-8
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

BITS:=$(shell dpkg-architecture | fgrep DEB_TARGET_ARCH_BITS= | cut -f 2 -d'=')
ifeq ($(BITS),64)
  64BIT:=yes
else
  64BIT:=no
endif

%:
	dh $@

override_dh_auto_build:
	dh_auto_build -- prefix=$(DESTDIR) 64bit=$(64BIT) errorcheck=no

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_test -- useshared=yes 64bit=$(64BIT) testthreads=5
endif

override_dh_auto_install:
	dh_auto_install -- 64bit=$(64BIT) prefix=$(DESTDIR)

override_dh_installdocs:
	cp $(CURDIR)/README.md $(CURDIR)/README
	dh_installdocs