#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

ifneq (,$(filter $(DEB_HOST_ARCH), armel x32))
	PLATFORM = --platform=unknown
endif

ifeq ($(DEB_HOST_ARCH), i386)
	PLATFORM = --disable-sse
endif

%:
	dh ${@}

override_dh_auto_configure:
	dh_auto_configure -- \
		--prefix=/usr \
		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
		--includedir=/usr/include \
		--mandir=/usr/share/man \
		--cores=2 \
		$(PLATFORM)

override_dh_auto_test:
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 i386))
	$(MAKE) -j1 check
endif

execute_after_dh_auto_clean:
	rm -f build/ck.spec include/freebsd/ck_md.h src/Makefile
