#!/usr/bin/make -f

include /usr/share/ocaml/ocamlvars.mk

DESTDIR = $(CURDIR)/debian/tmp
export OCAMLFIND_DESTDIR=$(DESTDIR)$(OCAML_STDLIB_DIR)
export PKG_CONFIG_PATH=/usr/lib/$(DEB_BUILD_ARCH)/pkgconfig

%:
	dh $@ --with ocaml

override_dh_autoreconf:
	./bootstrap

override_dh_auto_build:
	$(MAKE) all doc

override_dh_auto_install:
	mkdir -p $(DESTDIR)/$(OCAML_STDLIB_DIR)
	$(MAKE) install DESTDIR=$(DESTDIR) \
               prefix=$(DESTDIR)/usr sysconfdir=$(DESTDIR)/etc \
			   bashcompdir=$(DESTDIR)/usr/share/bash-completion/completions \
               OCAMLFIND_LDCONF=ignore
	dh_install
