#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
#
# 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

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

# Ignore "make check" for the moment, as building DefaultGrammar.pdf may
# fail.
export DEB_BUILD_OPTIONS=nocheck

OCAMLABI:=$(shell ocamlc -version)
BYTECODE =$(shell [ -x /usr/bin/ocamlopt ] || echo yes)
OCAMLRUN =$(if $(BYTECODE),ocaml-base-nox-$(OCAMLABI))

%:
	dh $@

get-orig-source:
	darcs pull

override_dh_auto_configure:
	ocaml configure.ml --prefix /usr --ocaml-libs /usr/lib/ocaml --ocamlfind-dir /usr/lib/ocaml --fonts-dir /usr/share/fonts/opentype

override_dh_install:
	dh_install -XAsana-Math.otf

build-stamp:
	dh_testdir

	if [ -x /usr/bin/ocamlopt ]; then \
		$(MAKE) -C src all; \
	else \
		$(MAKE) -C src byte; \
	fi

override_dh_gencontrol:
	dh_gencontrol -- -VF:OCamlRun="$(OCAMLRUN)"
