#!/usr/bin/make -f

export DH_VERBOSE=1

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

# Upstream's makefiles will respect PREFIX, and this means we avoid a patch
export PREFIX=/usr

%:
	dh $@

DH_AUTO_CONFIGURE_OPTS :=DH_AUTO_CONFIGURE_OPTS += -DZSTD_BUILD_TESTS:BOOL=OFF

override_dh_auto_clean:
	dh_auto_clean
	dh_auto_clean --sourcedirectory=contrib/pzstd

override_dh_auto_build:
	dh_auto_build -- ZSTD_LEGACY_MULTITHREADED_API=1
	dh_auto_build --sourcedirectory=contrib/pzstd/ -- pzstd

override_dh_install:
	# Call d-shlibmove to comply with library packaging guide
	dh_install

