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

include /usr/share/ocaml/ocamlvars.mk

PKGNAME = libocamlnet-ocaml-dev
DESTDIR = $(CURDIR)/debian/tmp
export OCAMLFIND_DESTDIR = $(DESTDIR)$(OCAML_STDLIB_DIR)

BUILD_TARGET = all
ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
BUILD_TARGET += opt
endif

CFGFLAGS =
CFGFLAGS += -enable-gtk2 -enable-ssl
CFGFLAGS += -with-nethttpd -prefer-netcgi2 -with-rpc-auth-dh
CFGFLAGS += -bindir /usr/bin -datadir /usr/share/ocamlnet
CFGFLAGS += -enable-apache -apache /usr/sbin/apache2 -apxs /usr/bin/apxs2

%:
	dh $@ --with ocaml

.PHONY: override_dh_auto_configure
override_dh_auto_configure:
	./configure $(CFGFLAGS)

.PHONY: override_dh_auto_build
override_dh_auto_build:
	$(MAKE) $(BUILD_TARGET)

.PHONY: override_dh_auto_install
override_dh_auto_install:
	$(MAKE) install DESTDIR=$(DESTDIR)

.PHONY: override_dh_auto_clean
override_dh_auto_clean:
	dh_auto_clean
	rm -Rf src/netcgi2-apache/.libs/

.PHONY: override_dh_install
override_dh_install:
	dh_install --fail-missing -X.so.owner

.PHONY: override_dh_compress
override_dh_compress:
	dh_compress -X.ml
