TOP_DIR := ../..
-include $(TOP_DIR)/Makefile.rules
include ../examples.rules

# Change this to the directory where you install .cmo files to be run
# by mod_caml.
MODCAML_BINDIR := /usr/lib/mod_caml/caml-bin

# Change this to the directory where you want to install templates.
MODCAML_TEMPLATEDIR := /var/www/caml-templates

INCDIRS := $(OCAMLLIBPATH)/apache $(shell ocamlfind query pcre) $(CAMLTEMPLATE_DIR)
LIBS := unix pcre cgi $(CAMLTEMPLATE_LIB)

SOURCES := cthello.ml

TRASH := *~ cthello.ml

OCAMLMAKEFILE := $(TOP_DIR)/OCamlMakefile

.PHONY: all
all: cthello.ml byte-code-nolink

cthello.ml: cthello.ml.in
	sed -e 's,@MODCAML_TEMPLATEDIR@,$(MODCAML_TEMPLATEDIR),g' \
	< $< > $@

.PHONY: install
install:
	cp cthello.cmo $(MODCAML_BINDIR)
	mkdir -p $(MODCAML_TEMPLATEDIR)
	cp cthello.tmpl $(MODCAML_TEMPLATEDIR)

include $(TOP_DIR)/OCamlMakefile
