Release coccinelle-0.1
[bpt/coccinelle.git] / menhirlib / Makefile
1 ##############################################################################
2 # Variables
3 ##############################################################################
4 TARGET=menhirLib
5
6 SRC= infiniteArray.ml packedIntArray.ml rowDisplacement.ml engineTypes.ml \
7 engine.ml tableFormat.ml tableInterpreter.ml convert.ml
8
9 LIBS=
10 INCLUDES=
11
12 # copy what the menhir authors do
13 EXTRAOPT=-for-pack MenhirLib
14
15 ##############################################################################
16 # Generic variables
17 ##############################################################################
18 OCAMLCFLAGS=-g -dtypes
19 OPTFLAGS=
20
21 OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES)
22 OCAMLOPT= ocamlopt$(OPTBIN) $(OPTFLAGS) $(EXTRAOPT) $(INCLUDES)
23 OCAMLOPT2=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
24 OCAMLLEX=ocamllex$(OPTBIN)
25 OCAMLYACC=ocamlyacc -v
26 OCAMLDEP=ocamldep$(OPTBIN) $(INCLUDES)
27 OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES)
28
29 OBJS= $(SRC:.ml=.cmo)
30 OPTOBJS= $(SRC:.ml=.cmx)
31
32
33 ##############################################################################
34 # Top rules
35 ##############################################################################
36 all: $(TARGET).cma menhirLib.cmo
37 all.opt: $(TARGET).cmxa menhirLib.cmx
38 opt: all.opt
39
40 $(TARGET).cma: $(OBJS) $(LIBS)
41 $(OCAMLC) -a -o $@ $(OBJS)
42
43 $(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa)
44 $(OCAMLOPT) -a -o $@ $(OPTOBJS)
45
46 # I thought at first that only one file menhirLib.ml
47 # was needed but in fact it's a wierd cos menhirLib.cmo results from multi
48 # files. They used the -pack ocamlc option, and for strange reason
49 # decided to produce a .cma instead of a classical .cma.
50 # So I put all the necesseray files in this directory.
51
52 # copy what the menhir authors do in their own makefile
53 menhirLib.cmo: $(OBJS)
54 $(OCAMLC) -pack -o menhirLib.cmo $^
55
56 menhirLib.cmx: $(OPTOBJS)
57 $(OCAMLOPT2) -pack -o menhirLib.cmx $^
58
59 ##############################################################################
60 # Generic rules
61 ##############################################################################
62 .SUFFIXES: .ml .mli .cmo .cmi .cmx
63
64 .ml.cmo:
65 $(OCAMLC) -c $<
66 .mli.cmi:
67 $(OCAMLC) -c $<
68 .ml.cmx:
69 $(OCAMLOPT) -c $<
70
71 .ml.mldepend:
72 $(OCAMLC) -i $<
73
74 clean::
75 rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot
76
77 clean::
78 rm -f *~ .*~ gmon.out #*#
79
80 beforedepend::
81
82 depend:: beforedepend
83 $(OCAMLDEP) *.mli *.ml > .depend
84
85 -include .depend