Commit | Line | Data |
---|---|---|
0708f913 C |
1 | |
2 | -include ../Makefile.config | |
3 | ||
34e49164 C |
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= | |
b1b2de81 | 13 | INCLUDES= |
34e49164 C |
14 | |
15 | # copy what the menhir authors do | |
16 | EXTRAOPT=-for-pack MenhirLib | |
17 | ||
18 | ############################################################################## | |
19 | # Generic variables | |
20 | ############################################################################## | |
708f4980 | 21 | OCAMLCFLAGS ?=-g -dtypes |
34e49164 C |
22 | OPTFLAGS= |
23 | ||
b1b2de81 C |
24 | OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) |
25 | OCAMLOPT= ocamlopt$(OPTBIN) $(OPTFLAGS) $(EXTRAOPT) $(INCLUDES) | |
26 | OCAMLOPT2=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) | |
34e49164 C |
27 | OCAMLLEX=ocamllex$(OPTBIN) |
28 | OCAMLYACC=ocamlyacc -v | |
0708f913 | 29 | OCAMLDEP=ocamldep$(OPTBIN) $(INCLUDES) |
34e49164 C |
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 | ||
b1b2de81 | 49 | # I thought at first that only one file menhirLib.ml |
34e49164 | 50 | # was needed but in fact it's a wierd cos menhirLib.cmo results from multi |
b1b2de81 | 51 | # files. They used the -pack ocamlc option, and for strange reason |
34e49164 C |
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 | ||
b1b2de81 | 74 | .ml.mldepend: |
34e49164 C |
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 | ||
b1b2de81 C |
88 | distclean:: |
89 | rm -f .depend | |
90 | ||
34e49164 | 91 | -include .depend |