1#**************************************************************************
2#*                                                                        *
3#*                                 OCaml                                  *
4#*                                                                        *
5#*            Xavier Leroy, projet Cristal, INRIA Rocquencourt            *
6#*                                                                        *
7#*   Copyright 1999 Institut National de Recherche en Informatique et     *
8#*     en Automatique.                                                    *
9#*                                                                        *
10#*   All rights reserved.  This file is distributed under the terms of    *
11#*   the GNU Lesser General Public License version 2.1, with the          *
12#*   special exception on linking described in the file LICENSE.          *
13#*                                                                        *
14#**************************************************************************
15
16# The lexer generator
17include ../config/Makefile
18CAMLRUN ?= ../boot/ocamlrun
19CAMLYACC ?= ../boot/ocamlyacc
20
21ROOTDIR=..
22
23ifeq "$(wildcard $(ROOTDIR)/flexdll/Makefile)" ""
24export OCAML_FLEXLINK:=
25else
26export OCAML_FLEXLINK:=$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe
27endif
28
29CAMLC=$(CAMLRUN) ../boot/ocamlc -strict-sequence -nostdlib -I ../boot \
30      -use-prims ../byterun/primitives
31CAMLOPT=$(CAMLRUN) ../ocamlopt -nostdlib -I ../stdlib
32COMPFLAGS=$(INCLUDES) -absname -w +a-4-9-41-42-44-45-48 -warn-error A \
33          -safe-string -strict-sequence -strict-formats -bin-annot
34LINKFLAGS=
35YACCFLAGS=-v
36CAMLLEX=$(CAMLRUN) ../boot/ocamllex
37CAMLDEP=$(CAMLRUN) ../tools/ocamldep
38
39
40OBJS=cset.cmo syntax.cmo parser.cmo lexer.cmo table.cmo lexgen.cmo \
41     compact.cmo common.cmo output.cmo outputbis.cmo main.cmo
42
43all: ocamllex
44allopt: ocamllex.opt
45
46ocamllex: $(OBJS)
47	$(CAMLC) $(LINKFLAGS) -compat-32 -o ocamllex $(OBJS)
48
49ocamllex.opt: $(OBJS:.cmo=.cmx)
50	$(CAMLOPT) -o ocamllex.opt $(OBJS:.cmo=.cmx)
51
52clean::
53	rm -f ocamllex ocamllex.opt
54	rm -f *.cmo *.cmi *.cmx *.cmt *.cmti *.$(O) *~
55
56parser.ml parser.mli: parser.mly
57	$(CAMLYACC) $(YACCFLAGS) parser.mly
58
59clean::
60	rm -f parser.ml parser.mli parser.output
61
62beforedepend:: parser.ml parser.mli
63
64lexer.ml: lexer.mll
65	$(CAMLLEX) lexer.mll
66
67clean::
68	rm -f lexer.ml
69
70beforedepend:: lexer.ml
71
72.SUFFIXES:
73.SUFFIXES: .ml .cmo .mli .cmi .cmx
74
75.ml.cmo:
76	$(CAMLC) -c $(COMPFLAGS) $<
77
78.mli.cmi:
79	$(CAMLC) -c $(COMPFLAGS) $<
80
81.ml.cmx:
82	$(CAMLOPT) -c $(COMPFLAGS) $<
83
84depend: beforedepend
85	$(CAMLDEP) -slash *.mli *.ml > .depend
86
87include .depend
88