#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

include /usr/share/ocaml/ocamlvars.mk

TMPDIR=debian/tmp
DESTDIR=$(TMPDIR)/$(OCAML_STDLIB_DIR)

%:
	dh $@ --with ocaml

override_dh_auto_build:
	if ! test -f .depend.org; then cp .depend .depend.org; fi
	$(MAKE) depend
	$(MAKE) DEBUG_OPT="-g" default
ifneq ($(OCAML_OPT_ARCH),)
	$(MAKE) opt
endif
	$(MAKE) doc
	mv doc html

override_dh_auto_clean:
	$(MAKE) clean
	-$(RM) -f .DS_Store
	if test -f .depend.org; then mv .depend.org .depend; fi
	-$(RM) -rf $(TMPDIR) doc html

override_dh_auto_install:
	mkdir -p $(DESTDIR)
	$(MAKE) install OCAMLFIND_DESTDIR=$(DESTDIR) OCAMLFIND_LDCONF=ignore
