#!/usr/bin/make -f
# debian/rules for ocaml-tools

include /usr/share/ocaml/ocamlvars.mk

DESTDIR := $(CURDIR)/debian/ocaml-tools

# top level dir for documentation
DOCDIR = /usr/share/doc/ocaml-tools

# share dir where files are to be installed
SHDIR = /usr/share/ocaml-tools

VIMDIR = /usr/share/vim/addons

# omlet source dir
OMLETSRC = $(shell echo omlet-*)

%:
	dh $@ --with ocaml

override_dh_auto_build:
	$(MAKE) -C ocaml-autoconf/
	$(MAKE) -C ocamldot/ ocamldot
	cp ocaml-autoconf/README ocaml-autoconf/README.ocaml-autoconf
	cd omlet-* && (cp README README.omlet ; cp ChangeLog changelog.omlet)
	cp ocamldot/README README.ocamldot

override_dh_auto_clean:
	$(MAKE) -C ocaml-autoconf/ clean
	$(MAKE) -C ocamldot/ clean
	rm -f ocaml-autoconf/README.ocaml-autoconf
	rm -f omlet-*/README.omlet omlet-*/changelog.omlet
	rm -f README.ocamldot

override_dh_auto_install:
	BASE=$(DESTDIR)/$(VIMDIR) make -C $(OMLETSRC) install-aux
	echo 'F:OCamlABI=$(OCAML_ABI)' >> debian/ocaml-tools.substvars
