#!/usr/bin/make -f
# -*- makefile -*-

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

export OCAMLFIND_DESTDIR = $(OCAML_STDLIB_DIR)
export OCAMLFIND_LDCONF = ignore

EXAMPLES_TARBALL = debian/examples.tar.gz

%:
	dh $@ --with ocaml

$(EXAMPLES_TARBALL):
	tar -czf $(EXAMPLES_TARBALL) --exclude=parse.ml examples

override_dh_auto_configure: $(EXAMPLES_TARBALL)
	./configure --prefix=/usr

override_dh_auto_install:
ifneq (,$(findstring libmlpost-ocaml-doc,$(shell dh_listpackages)))
	$(MAKE) doc HOME=$(shell mktemp -d)
endif
	mkdir -p $(DESTDIR)$(OCAMLFIND_DESTDIR)
	$(MAKE) install DESTDIR= OCAMLFIND_DESTDIR=$(DESTDIR)$(OCAMLFIND_DESTDIR) BINDIR=$(DESTDIR)/usr/bin MANDIR=$(DESTDIR)/usr/share/man

override_dh_auto_test:

override_dh_dwz:
