blob: 691e0fa07ee460dc83c551f15ec5e28b7a038cc6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
# Cours "Sémantique et Application à la Vérification de programmes"
#
# Antoine Miné 2014
# Ecole normale supérieure, Paris, France / CNRS / INRIA
# Makefile
# points to compilers
#
# (we rely heavily on ocamlfind)
# (no change needed, the default ones in /usr/bin should be good)
#
OCAMLFIND = ocamlfind
OCAMLLEX = ocamllex
MENHIR = menhir
# options for compilers
#
# (change this if you want to enable/disable debugging)
#
OCAMLCFLAGS = -g
OCAMLOPTFLAGS = -g
OCAMLLEXFLAGS =
MENHIRFLAGS = --explain
# library paths
#
# (change this if you add new subdirectories or libraries)
#
OCAMLINC = -I frontend -I libs -I corrections -I +zarith
# libraries
#
# (change this to add new libraries)
#
LIBS = -package zarith
CMXA =
CMA =
# name of the compiled executable
#
# (change to a better name matching your project)
#
TARGET = main
# compile either to byte code or native code
#
# uncomment only one of the two lines!
#
all: $(TARGET).byte
#all: $(TARGET).opt
# list of automatically generated files (by ocamllex and menhir)
#
# (this will probably not change during the project)
#
AUTOGEN = \
frontend/lexer.ml \
frontend/parser.ml \
frontend/parser.mli
# list of ML source files to compile (including automatically generated)
#
# add your files here, in the right order!
#
MLFILES = \
libs/mapext.ml \
frontend/abstract_syntax_tree.ml \
frontend/abstract_syntax_printer.ml \
frontend/parser.ml \
frontend/lexer.ml \
frontend/file_parser.ml \
main.ml
# list of MLI source files
#
# add your files here
# (this is only used for ocamldep)
#
MLIFILES = \
libs/mapext.mli \
frontend/parser.mli \
frontend/abstract_syntax_printer.mli \
frontend/file_parser.mli
# below are general compilation rules
#
# you probably don't need to change anything below this point
# list of object files, derived from ML sources
#
CMOFILES = $(MLFILES:%.ml=%.cmo)
CMXFILES = $(MLFILES:%.ml=%.cmx)
$(TARGET).byte: $(CMOFILES)
$(OCAMLFIND) ocamlc -o $@ $(OCAMLCFLAGS) $(OCAMLINC) $(LIBS) $(CMA) -linkpkg $+
# native link
$(TARGET).opt: $(CMXFILES)
$(OCAMLFIND) ocamlopt -o $@ $(OCAMLOPTFLAGS) $(OCAMLINC) $(LIBS) $(CMXA) -linkpkg $+
# compilation rules
%.cmo: %.ml %.cmi
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLINC) $(LIBS) -c $*.ml
%.cmx: %.ml %.cmi
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLINC) $(LIBS) -c $*.ml
%.cmi: %.mli
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLINC) $(LIBS) -c $*.mli
%.cmo: %.ml
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) $(OCAMLINC) $(LIBS) -c $*.ml
%.cmx: %.ml
$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) $(OCAMLINC) $(LIBS) -c $*.ml
%.ml: %.mll
$(OCAMLLEX) $(OCAMLLEXFLAGS) $*.mll
%.ml %.mli: %.mly
$(MENHIR) $(MENHIRFLAGS) $*.mly
# remove temporaries and binaries
#
clean:
rm -f depend $(AUTOGEN) $(TARGET).byte $(TARGET).opt
rm -f `find . -name "*.o"`
rm -f `find . -name "*.a"`
rm -f `find . -name "*.cm*"`
rm -f `find . -name "*~"`
rm -f `find . -name "\#*"`
rm -f `find . -name "*.conflicts"`
.phony: clean
# automatic dependencies
#
depend: $(MLFILES) $(MLIFILES)
-$(OCAMLFIND) ocamldep -native $(OCAMLINC) $+ > depend
include depend
|