#!/usr/bin/make -f

#export DH_VERBOSE=1

include /usr/share/dpatch/dpatch.make

TARGETDIR = $(CURDIR)/debian/libhttp-ocaml-dev
OCAML_LIB_DIR = $(shell ocamlc -where)

build: build-stamp
build-stamp: patch-stamp
	dh_testdir
	$(MAKE) all
	if [ -x /usr/bin/ocamlopt ]; then $(MAKE) opt; else true; fi
	touch build-stamp

clean: patch clean1 unpatch
clean1:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	-$(MAKE) distclean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	$(MAKE) install DESTDIR=$(TARGETDIR)$(OCAML_LIB_DIR)

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installexamples
	dh_installchangelogs 
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-arch
.PHONY: build clean binary-arch binary install
