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

#export DH_VERBOSE=1

include /usr/share/ocaml/ocamlvars.mk

BACKUP=.depend

override_dh_auto_configure:
	./configure --host=$(DEB_HOST_GNU_TYPE) \
	--build=$(DEB_BUILD_GNU_TYPE)           \
	--prefix=/usr                           \
	--libdir=$(OCAML_STDLIB_DIR)            \
	--mandir=\$${prefix}/share/man

override_dh_auto_build:
	for i in $(BACKUP); do \
		cp -ax $$i $$i.debian; \
	done
	# we have to assure that configure is newer than configure.in since
	# patch 0005 patches them both (see bug #669539)
	touch configure
	$(MAKE) all

override_dh_auto_clean:
	if [ -f Makefile ]; then \
		$(MAKE) dist-clean;   \
	fi
	for i in $(BACKUP); do \
		[ ! -f $$i.debian ] || mv $$i.debian $$i; \
	done

%:
	dh --with ocaml $@
