#!/usr/bin/make -f

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

%:
	dh $@ --with ocaml

override_dh_auto_configure:

override_dh_auto_install:
	mkdir -p '$(OCAMLFIND_DESTDIR)'
ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
	dh_auto_install
else
	make install_byteonly DESTDIR=$(DESTDIR)
endif
	
	# ocaml-dangling-cmi
	cp src/lib/sedlexing.mli $(OCAMLFIND_DESTDIR)/sedlex/

override_dh_auto_test:
ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
	# the test target doesn't support parallel build
	dh_auto_test --no-parallel
else
	# the test requires ocamlopt
endif

override_dh_missing:
	dh_missing --fail-missing
