#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/ocaml.mk

PKGNAME = libextlib-ocaml-dev
OCAML_OCAMLDOC_PACKAGES = $(OCAML_LIBDEV_PACKAGES)
PKGDIR = $(CURDIR)/debian/tmp
DESTDIR = $(PKGDIR)$(OCAML_STDLIB_DIR)/extlib
DOCDIR = $(PKGDIR)/usr/share/doc/$(PKGNAME)/

common-build-arch::
	mkdir -p $(DESTDIR)/ $(DOCDIR)/
	if [ -x /usr/bin/ocamlopt ]; then \
		ocaml install.ml -d $(DESTDIR)/ -b -n -nodoc; \
		ocamlopt -shared -linkall -o $(DESTDIR)/extLib.cmxs -I $(DESTDIR) $(DESTDIR)/extLib.cmxa; \
	else \
		ocaml install.ml -d $(DESTDIR)/ -b -nodoc; \
	fi
	cp -a extLib.ml *.mli $(DESTDIR)/
	cp -a META $(DESTDIR)/META
