#!/usr/bin/make -f

DESTDIR=$(CURDIR)/debian/tmp
include /usr/share/ocaml/ocamlvars.mk
export OCAMLFIND_DESTDIR=$(DESTDIR)$(OCAML_STDLIB_DIR)

ifeq ($(OCAML_HAVE_OCAMLOPT),no)
OBUILD_CONF_ARGS ?= --disable-executable-native --disable-library-native --disable-library-plugin --enable-executable-bytecode --enable-library-bytecode
endif

%:
	dh $@ --with ocaml

override_dh_auto_configure:
	obuild configure $(OBUILD_CONF_ARGS)

override_dh_auto_build:
	obuild build

# Disable test since the test isn't compatible with recent version of qcheck.
# Error: Cannot find file qcheck_runner.cmxa
override_dh_auto_test:

override_dh_auto_install:
	mkdir -p '$(OCAMLFIND_DESTDIR)'
	obuild install --destdir $(OCAMLFIND_DESTDIR)

override_dh_missing:
	dh_missing --fail-missing
