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