##########################################################################
#                   Cameleon                                             #
#                                                                        #
#      Copyright (C) 2002 Institut National de Recherche en Informatique et   #
#      en Automatique. All rights reserved.                              #
#                                                                        #
#      This program is free software; you can redistribute it and/or modify  #
#      it under the terms of the GNU General Public License as published by  #
#      the Free Software Foundation; either version 2 of the License, or  #
#      any later version.                                                #
#                                                                        #
#      This program is distributed in the hope that it will be useful,   #
#      but WITHOUT ANY WARRANTY; without even the implied warranty of    #
#      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     #
#      GNU General Public License for more details.                      #
#                                                                        #
#      You should have received a copy of the GNU General Public License  #
#      along with this program; if not, write to the Free Software       #
#      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA          #
#      02111-1307  USA                                                   #
#                                                                        #
#      Contact: Maxence.Guesdon@inria.fr                                #
##########################################################################


include ../../../master.Makefile

CMOFILES=ocamlsql_types.cmo\
	ocamlsql_messages.cmo\
	ocamlsql_parser.cmo\
	ocamlsql_lexer.cmo\
	ocamlsql_print.cmo\
	ocamlsql.cmo


CMXFILES=$(CMOFILES:.cmo=.cmx)
CMIFILES=$(CMOFILES:.cmo=.cmi)

LIB_OCAMLSQL_CMI=$(LIB_OCAMLSQL:.cma=.cmi)
LIB_OCAMLSQL_A=$(LIB_OCAMLSQL_OPT:.cmxa=.a)


LIB_OCAMLSQL=ocamlsql.cma
####

all: byte opt
byte: $(LIB_OCAMLSQL)
opt: $(LIB_OCAMLSQL_OPT)

$(LIB_OCAMLSQL): $(CMIFILES) ocamlsql_parser.cmi $(CMOFILES)
	$(OCAMLC) -a -linkall -o $@ $(CMOFILES)

$(LIB_OCAMLSQL_OPT): $(CMIFILES) ocamlsql_parser.cmi $(CMXFILES)
	$(OCAMLOPT) -a -linkall -o $@ $(CMXFILES)

# Doc :
#######
dump.odoc: dummy
	$(OCAMLDOC) $(OCAMLPP) $(COMPFLAGS) -dump dump.odoc *.ml *.mli

# installation :
################
install:
	$(MKDIR) $(LIBDIR)
	$(CP) $(LIB_OCAMLSQL) $(LIB_OCAMLSQL_CMI) $(LIBDIR)
	if test -f $(LIB_OCAMLSQL_OPT) ; then $(MAKE) installopt ; fi

installopt:
	$(MKDIR) $(LIBDIR)
	$(CP) $(LIB_OCAMLSQL_OPT) $(LIB_OCAMLSQL_CMI) $(LIB_OCAMLSQL_A) $(LIBDIR)



# backup, clean and depend :
############################
clean:
	$(RM) *~ #*# *-
	@$(RM) *.o $(CMIFILES) $(CMOFILES) $(CMXFILES) *.a *.cmi
	@$(RM) $(LIB_OCAMLSQL) $(LIB_OCAMLSQL_OPT)
	@$(RM) ocamlsql_parser.output ocamlsql_parser.ml ocamlsql_parser.mli

distclean: clean
	@$(RM)

.depend depend::
	$(OCAMLDEP) *.ml *.mli > .depend

dummy:

include .depend
