#########################################################################
#                                                                       #
#                            Objective Caml                             #
#                                                                       #
#            Xavier Leroy, projet Cristal, INRIA Rocquencourt           #
#                                                                       #
#   Copyright 1999 Institut National de Recherche en Informatique et    #
#   en Automatique.  All rights reserved.  This file is distributed     #
#   under the terms of the GNU Library General Public License.          #
#                                                                       #
#########################################################################

# $Id: Makefile,v 1.2 1999/11/17 18:57:40 xleroy Exp $

# Makefile for the ndbm library

include ../../config/Makefile

# Compilation optiosn
CC=$(BYTECC) -g
CAMLC=../../boot/ocamlrun ../../boot/ocamlc -I ../../stdlib
CAMLOPT=../../boot/ocamlrun ../../ocamlopt -I ../../stdlib
CFLAGS=-I../../byterun -O $(BYTECCCOMPOPTS)
COBJS=dbstubs.o

all: libmldb.a db.cmi db.cma

allopt: libmldb.a db.cmi db.cmxa

libmldb.a: $(COBJS)
	rm -rf libmldb.a
	ar rc libmldb.a $(COBJS)
	$(RANLIB) libmldb.a

db.cma: db.cmo
	$(CAMLC) -a -o db.cma db.cmo

db.cmxa: db.cmx
	$(CAMLOPT) -a -o db.cmxa db.cmx

partialclean:
	rm -f *.cm*

clean: partialclean
	rm -f *.a *.o

install:
	cp libmldb.a $(LIBDIR)/libmldb.a
	cd $(LIBDIR); $(RANLIB) libmldb.a
	cp db.cma db.cmi db.mli $(LIBDIR)

installopt:
	cp db.cmx db.cmxa db.a $(LIBDIR)
	cd $(LIBDIR); $(RANLIB) db.a

.SUFFIXES: .ml .mli .cmo .cmi .cmx

.mli.cmi:
	$(CAMLC) -c $(COMPFLAGS) $<

.ml.cmo:
	$(CAMLC) -c $(COMPFLAGS) $<

.ml.cmx:
	$(CAMLOPT) -c $(COMPFLAGS) $<

depend:
	../../tools/ocamldep *.mli *.ml > .depend

include .depend
