##########################################################################
#                   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

LINKFLAGS=$(INCLUDES)

REPFILES=th_double_list_in_table.rep \
	th_frame_table.rep \
	th_frameset.rep \
	th_list_in_table.rep \
	th_page_base.rep \
	th_seq.rep

MLREPFILES=$(REPFILES:.rep=.ml)

CMOREPFILES=$(REPFILES:.rep=.cmo)

CMOFILES=th_types.cmo\
	$(CMOREPFILES) \
	toolhtml.cmo

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

LIB_TOOLHTML_CMI=$(LIB_TOOLHTML:.cma=.cmi)
LIB_TOOLHTML_A=$(LIB_TOOLHTML_OPT:.cmxa=.a)

byte: lib
all: byte opt
opt: lib_opt
debug: 
	$(MAKE) OCAMLPP=""

lib: $(CMIFILES) $(CMOFILES)
	$(OCAMLC) -a -o $(LIB_TOOLHTML) $(LINKFLAGS) $(CMOFILES)

lib_opt: $(CMIFILES) $(CMXFILES)
	$(OCAMLOPT) -a -o $(LIB_TOOLHTML_OPT) $(LINKFLAGS_OPT) $(CMXFILES)

O_FILES=$(CMXFILES:.cmx=.o)

# installation :
################
install:
	$(MKDIR) $(LIBDIR)
	$(CP) $(LIB_TOOLHTML) $(LIB_TOOLHTML_CMI) $(LIBDIR)
	if test -f $(LIB_TOOLHTML_OPT) ; then $(MAKE) installopt ; fi

installopt:
	$(CP) $(LIB_TOOLHTML_OPT) $(LIB_TOOLHTML_CMI) $(LIB_TOOLHTML_A) $(LIBDIR)

# Documentation :
#################
dump.odoc: $(MLREPFILES)
	$(OCAMLDOC) $(OCAMLPP) $(COMPFLAGS) -dump dump.odoc *.ml *.mli

doc: dummy


# backup, clean and depend :
############################

clean::
	@rm -f *~ \#*\#
	@rm -f $(LIB_TOOLHTML) $(LIB_TOOLHTML_OPT)
	@rm -f *.cmo *.cmi *.cmx *.a *.o $(MLREPFILES)

distclean:: clean

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

dummy:

include .depend
