# Makefile generated by OCamake 
# http://tech.motion-twin.com
VERSION=2.3
OCAMLOPT=ocamlopt
OCAMLC=ocamlc
OCAMLFIND=ocamlfind

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

INSTALLDIR=`$(OCAMLC) -where`
ALL_CFLAGS= $(CFLAGS)
LFLAGS= -a
LIBS=
SRC=dtd.mli xml.dsp xml_lexer.mli xml.ml xmlParser.ml xml_parser.mly dtd.ml test.ml xml.dsw xml_lexer.mll xml.mli xmlParser.mli


all: bytecode test.exe doc

opt: native

native: xml-light.cmxa

bytecode: xml-light.cma

installcommon: all
	cp xml.mli xmlParser.mli dtd.mli xml.cmi xmlParser.cmi dtd.cmi $(INSTALLDIR)

installbyte: all installcommon
	cp xml-light.cma $(INSTALLDIR)

installopt: opt installcommon
	cp xml-light.a xml-light.cmxa xml.cmx dtd.cmx xmlParser.cmx $(INSTALLDIR)

install: installbyte installopt

wininstall: all opt
	cp xml-light.cmxa xml-light.lib xml-light.cma xml.mli xmlParser.mli dtd.mli xml.cmi xmlParser.cmi dtd.cmi xml.cmx dtd.cmx xmlParser.cmx c:\ocaml\lib

install_ocamlfind: all opt
	cp META.in META
	sed -itmp "s|@VERSION@|$(VERSION)|g" META
	rm -rf METAtmp
	$(OCAMLFIND) install xml-light META xml-light.a xml-light.cma xml-light.cmxa xml.cmx dtd.cmx xmlParser.cmx xml.mli xmlParser.mli dtd.mli xml.cmi xmlParser.cmi dtd.cmi

doc: doc/index.html
doc/index.html: xml.mli dtd.mli xmlParser.mli
	mkdir -p doc
	ocamldoc -sort -html -d doc xml.mli dtd.mli xmlParser.mli

test.exe: xml-light.cma
	$(OCAMLC) xml-light.cma test.ml -o test.exe

test_opt.exe: xml-light.cmxa
	$(OCAMLOPT) xml-light.cmxa test.ml -o test_opt.exe

xml-light.cma: xml_parser.cmo xml_lexer.cmo dtd.cmo xmlParser.cmo xml.cmo 
	$(OCAMLC) -o xml-light.cma $(LFLAGS) $(LIBS) xml_parser.cmo xml_lexer.cmo dtd.cmo xmlParser.cmo xml.cmo

xml-light.cmxa: xml_parser.cmx xml_lexer.cmx dtd.cmx xmlParser.cmx xml.cmx 
	$(OCAMLOPT) -o xml-light.cmxa $(LFLAGS) $(LIBS) xml_parser.cmx xml_lexer.cmx dtd.cmx xmlParser.cmx xml.cmx

dtd.cmo: xml.cmi xml_lexer.cmi dtd.cmi

dtd.cmx: xml.cmi xml_lexer.cmi dtd.cmi

xml.cmo: dtd.cmi xmlParser.cmi xml_lexer.cmi xml.cmi

xml.cmx: dtd.cmi xmlParser.cmi xml_lexer.cmi xml.cmi

xmlParser.cmo: dtd.cmi xml.cmi xml_lexer.cmi xmlParser.cmi

xmlParser.cmx: dtd.cmi xml.cmi xml_lexer.cmi xmlParser.cmi

dtd.cmi: xml.cmi

xml.cmi: 

xmlParser.cmi: dtd.cmi xml.cmi

xml_lexer.cmi: dtd.cmi

xml_parser.cmo: xml_parser.ml dtd.cmi xml_parser.mli xml_parser.cmi

xml_parser.cmx: xml_parser.ml dtd.cmi xml_parser.mli xml_parser.cmi

xml_parser.cmi: xml_parser.mli dtd.cmi xml.cmi

xml_lexer.cmo: xml_lexer.ml xml_lexer.cmi

xml_lexer.cmx: xml_lexer.ml xml_lexer.cmi

clean:
	rm -f xml-light.cma test.exe dtd.cmo dtd.cmi test.cmo test.cmi xml.cmo xml.cmi xmlParser.cmo xmlParser.cmi dtd.cmi xml.cmi xmlParser.cmi xml_lexer.cmi xml_lexer.cmo xml_lexer.ml xml_parser.mli xml_parser.cmi xml_parser.ml xml_parser.cmo
	rm -f xml-light.lib xml-light.a xml-light.cmxa test_opt.exe dtd.cmx dtd.obj dtd.o test.cmx test.obj test.o xml.cmx xml.obj xml.o xmlParser.cmx xmlParser.obj xmlParser.o xml_lexer.cmx xml_lexer.obj xml_lexer.o xml_parser.cmx xml_parser.obj xml_parser.o
	rm -rf doc


# SUFFIXES
.ml.cmo:
	$(OCAMLC) $(ALL_CFLAGS) -c $<

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

.mli.cmi:
	$(OCAMLC) $(ALL_CFLAGS) $<

.mll.ml:
	ocamllex $<

.mly.ml:
	ocamlyacc $<

Makefile: ;
$(SRC): ;
.PHONY: all opt native bytecode installcommon installbyte installopt install wininstall install_ocamlfind doc clean
