# Makefile - Don Yang (uguu.org)
#
# 10/12/07

SRCS = strutil.ml time.ml log.ml report.ml main.ml entry.ml
OBJS = $(SRCS:.ml=.cmx)
HDRS = $(SRCS:.ml=.mli)

EEXT = .exe
LIBS = unix.cmxa str.cmxa
DEPS = depend
TARGET = keine$(EEXT)

OCAML = ocaml
OCAMLC = ocamlc
OCAMLOPT = ocamlopt
OCAMLDEP = ocamldep

TEXI2HTML = texi2html
#TEXI2HTML = makeinfo --html --no-split

# Rules
.SUFFIXES: .ml .mli .cmx .cmi .texi .html

.ml.cmx:
	$(OCAMLOPT) -c $<

.mli.cmi:
	$(OCAMLC) -c $<

.texi.html:
	$(TEXI2HTML) $<

#Targets
all: $(TARGET) keine.html

$(TARGET): $(OBJS)
	ocamlopt str.cmxa unix.cmxa $(OBJS) -o $@

$(DEPS): $(SRCS) $(HDRS)
	$(OCAMLDEP) *.ml *.mli > $@

include $(DEPS)


# Maintenance
test:
	perl keine_test.pl ./keine.pl

clean:
	-rm -f *.cmi *.cmo *.cmx *.o $(TARGET) keine.html
	-rm -f keine_test_output.*

backup:
	-rm -f backup.tar.gz
	tar cf backup.tar *.pl *.ml *.mli *.dot *.texi *.sh Makefile tests/*
	gzip -9 backup.tar
