#!/usr/bin/make -f
# -*- makefile -*-
include /usr/share/ocaml/ocamlvars.mk

export OCAMLFIND_DESTDIR=$(CURDIR)/debian/tmp/$(OCAML_STDLIB_DIR)
export HAS_OCAMLOPT=$(OCAML_HAVE_OCAMLOPT)

%:
	dh $@ --with ocaml

.PHONY: override_dh_auto_clean
override_dh_auto_clean:
	$(MAKE) dist-clean

.PHONY: override_dh_auto_configure
override_dh_auto_configure:
	ocaml configure.ml

.PHONY: override_dh_auto_build
override_dh_auto_build:
	dh_auto_build
	$(MAKE) -C bench doc.bench
	cd bench && ps2pdf doc.ps

.PHONY: override_dh_auto_install
override_dh_auto_install:
	$(MAKE) install INSTALLBIN=debian/tmp/usr/bin INSTALLMAN=debian/tmp/usr/share/man/man1
	mkdir -p debian/tmp/usr/share/doc/libmelt-ocaml-dev/html
	cp -a _build/latex/latex.docdir debian/tmp/usr/share/doc/libmelt-ocaml-dev/html/latex
	cp -a _build/melt/melt.docdir debian/tmp/usr/share/doc/libmelt-ocaml-dev/html/melt
	rm -f debian/tmp/usr/share/doc/libmelt-ocaml-dev/*/*.stamp
