#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules for ara package.
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets  by Bill Allombert 2001

include /usr/share/ocaml/ocamlvars.mk

TMPDIR = $(CURDIR)/debian/tmp

ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
OCAML_INTERPRETER=
else
OCAML_INTERPRETER=ocaml-base-nox-$(OCAML_ABI)
endif

build: build-stamp
build-stamp: 
ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
	if [ -x /usr/bin/ocamlopt.opt ]; then \
	    $(MAKE) OPT=.opt ; \
        else \
	    $(MAKE) ; \
	fi
else
	if [ -x /usr/bin/ocamlc.opt ]; then \
	    $(MAKE) OPT=.opt bt ; \
	else \
	    $(MAKE) bt ; \
	fi
endif
	$(MAKE) doc
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	$(MAKE) clean
	-$(RM) -r $(TMPDIR)
	-$(RM) build-stamp
	dh_clean

install: build-stamp
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	mkdir -p $(TMPDIR)
ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
	$(MAKE) install DESTDIR=$(TMPDIR)
else
	$(MAKE) install_bt DESTDIR=$(TMPDIR)
endif

binary-indep: 

binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installchangelogs -a
	dh_install --list-missing -a
	dh_installdocs -a
	dh_installexamples -a
	dh_installmenu -a
	dh_installman -a
	dh_installinfo -a
	dh_link -a
	dh_compress -a
	dh_fixperms -a
	dh_strip -a
	dh_makeshlibs -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_ocaml -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-arch binary-indep
.PHONY: build clean binary-indep binary-arch binary install
