#!/usr/bin/make -f

DESTDIR=$(CURDIR)/debian/ocaml-obuild

%:
	dh $@ --with ocaml

override_dh_auto_build:
	./bootstrap

	# generate manpages
	help2man \
		--output "dist/build/obuild/obuild.1" \
		--name "parallel, incremental and declarative build system for OCaml" \
		--help-option "" \
		--no-discard-stderr \
		--no-info \
		dist/build/obuild/obuild
	help2man \
		--output "dist/build/obuild-simple/obuild-simple.1" \
		--name "simple package build system for OCaml" \
		--version-string " " \
		--no-discard-stderr \
		--no-info \
		dist/build/obuild-simple/obuild-simple

override_dh_auto_install:
# Check that installed files have not changed. If so, the Debian
# packaging must be adapted by hand. This way, we avoid a dependency
# on opam-installer.
	diff -u debian/ocaml-obuild.opam-install obuild.install

override_dh_install:
	mkdir -p "$(DESTDIR)/usr/bin"
	cp "dist/build/obuild/obuild" "dist/build/obuild-simple/obuild-simple" "$(DESTDIR)/usr/bin"