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

DESTDIR=$(CURDIR)/debian/tmp

include /usr/share/ocaml/ocamlvars.mk

BUILD_ARGS :=

ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
  BUILD_ARGS += native=true
else
  BUILD_ARGS += native=false
endif

ifeq ($(OCAML_NATDYNLINK),yes)
  BUILD_ARGS += native-dynlink=true
else
  BUILD_ARGS += native-dynlink=false
endif

%:
	dh $@ --with ocaml

.PHONY: override_dh_auto_build
override_dh_auto_build:
	ocaml pkg/build.ml $(BUILD_ARGS)

.PHONY: override_dh_auto_install
override_dh_auto_install:
	opam-installer --prefix=debian/tmp --libdir=.$(OCAML_STDLIB_DIR) --docdir=usr/share/doc react.install

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

.PHONY: override_dh_compress
override_dh_compress:
	dh_compress -X.ml
