#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
include /usr/share/ocaml/ocamlvars.mk

DESTDIR=$(CURDIR)/debian/tmp

%:
	dh $@ --with ocaml

override_dh_auto_build:
	dune build @all

override_dh_auto_install:
	dune install --destdir=$(DESTDIR) --prefix=/usr --libdir=$(OCAML_STDLIB_DIR)
	find $(DESTDIR) -name "test*" -type f -delete
	find $(DESTDIR) -name LICENSE.md -delete

override_dh_auto_test:
ifeq (,$(filter nocheck, $(DEB_BUILD_OPTIONS)))
ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
	cd test && ./test.sh
endif
endif
