#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

include /usr/share/ocaml/ocamlvars.mk

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

%:
	dh $@ --with ocaml

.PHONY: override_dh_auto_build
override_dh_auto_build:
ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
	$(MAKE) spamoracle
else
	$(MAKE) spamoracle.byte
endif

.PHONY: override_dh_auto_install
override_dh_auto_install:
ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
	$(MAKE) install DESTDIR=$(CURDIR)/debian/spamoracle
else
	$(MAKE) install.byte DESTDIR=$(CURDIR)/debian/spamoracle
endif
