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

DESTDIR=$(CURDIR)/debian/tmp
include /usr/share/ocaml/ocamlvars.mk
OCAMLFIND_DESTDIR=$(DESTDIR)/$(OCAML_STDLIB_DIR)/cmdliner
export OCAMLFIND_DESTDIR

TARGETS=cmdliner.cmi cmdliner.cma
ifeq ($(OCAML_BEST),opt)
TARGETS+=cmdliner.a cmdliner.cmx cmdliner.cmxa cmdliner.cmxs
endif

TO_INSTALL=$(addprefix _build/src/,$(TARGETS)) pkg/META src/cmdliner.mli

%:
	dh $@ --with ocaml

.PHONY: override_dh_auto_configure
override_dh_auto_configure:

.PHONY: override_dh_auto_build
override_dh_auto_build:
	ocamlbuild -classic-display $(TARGETS)

.PHONY: override_dh_auto_test
override_dh_auto_test:

.PHONY: override_dh_auto_install
override_dh_auto_install:
	mkdir -p '$(OCAMLFIND_DESTDIR)'
	cp $(TO_INSTALL) '$(OCAMLFIND_DESTDIR)'

.PHONY: override_dh_install
override_dh_install:
	dh_install --fail-missing

.PHONY: override_dh_auto_clean
override_dh_auto_clean:
	ocamlbuild -classic-display -clean
