#!/usr/bin/make -f
# -*- makefile -*-

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

include /usr/share/ocaml/ocamlvars.mk
DESTDIR := $(CURDIR)/debian/tmp

%:
	dh $@ --with ocaml

.PHONY: override_dh_auto_configure
override_dh_auto_configure:
	cp  src/.depend debian/src.depend.backup
	dh_auto_configure -- --with-gl --with-glade --with-rsvg		\
	--with-gnomecanvas --with-gtkspell --with-gnomeui \
	--with-gtksourceview2

.PHONY: override_dh_auto_build
override_dh_auto_build:
	$(MAKE)
ifneq ($(OCAML_OPT_ARCH),)
	$(MAKE) opt
endif

.PHONY: override_dh_auto_clean
override_dh_auto_clean:
	[ ! -f config.make ] || $(MAKE) clean
	if [ -f debian/src.depend.backup ]; then \
	  mv debian/src.depend.backup src/.depend; \
	fi

.PHONY: override_dh_auto_install
override_dh_auto_install:
	$(MAKE) install DESTDIR=$(DESTDIR)
# remove files related to gtksourceview1 (uncompiled anyway... and
# make dh_ocamldoc fail)
	rm \
	  debian/tmp/usr/lib/ocaml/lablgtk2/gtkSourceView_types.mli \
	  debian/tmp/usr/lib/ocaml/lablgtk2/gSourceView.mli

.PHONY: override_dh_installexamples
override_dh_installexamples:
	dh_installexamples --exclude='.cvsignore'

.PHONY: override_dh_install
override_dh_install:
	dh_install --list-missing
