blob: d4e61befa4e2b0975cac23d3e435192df2d9e960 (
plain)
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
|
#########################################################################
# #
# Objective Caml #
# #
# Xavier Leroy, projet Cristal, INRIA Rocquencourt #
# #
# Copyright 1999 Institut National de Recherche en Informatique et #
# en Automatique. All rights reserved. This file is distributed #
# under the terms of the Q Public License version 1.0. #
# #
#########################################################################
# $Id$
include ../config/Makefile
CAMLRUN=../boot/ocamlrun
CAMLC=$(CAMLRUN) ../boot/ocamlc -strict-sequence -nostdlib -I ../boot
CAMLOPT=$(CAMLRUN) ../ocamlopt -nostdlib -I ../stdlib
CAMLLEX=$(CAMLRUN) ../boot/ocamllex
INCLUDES=-I ../utils -I ../parsing -I ../typing -I ../bytecomp -I ../asmcomp \
-I ../driver
COMPFLAGS= -warn-error A $(INCLUDES)
LINKFLAGS=$(INCLUDES)
all: ocamldep ocamlprof ocamlcp ocamlmktop ocamlmklib dumpobj
# scrapelabels addlabels
.PHONY: all
opt.opt: ocamldep.opt
.PHONY: opt.opt
# The dependency generator
CAMLDEP_OBJ=depend.cmo ocamldep.cmo
CAMLDEP_IMPORTS=misc.cmo config.cmo clflags.cmo terminfo.cmo \
linenum.cmo warnings.cmo location.cmo longident.cmo \
syntaxerr.cmo parser.cmo lexer.cmo parse.cmo
ocamldep: depend.cmi $(CAMLDEP_OBJ)
$(CAMLC) $(LINKFLAGS) -o ocamldep $(CAMLDEP_IMPORTS) $(CAMLDEP_OBJ)
ocamldep.opt: depend.cmi $(CAMLDEP_OBJ:.cmo=.cmx)
$(CAMLOPT) $(LINKFLAGS) -o ocamldep.opt $(CAMLDEP_IMPORTS:.cmo=.cmx) \
$(CAMLDEP_OBJ:.cmo=.cmx)
# ocamldep is precious: sometimes we are stuck in the middle of a
# bootstrap and we need to remake the dependencies
clean::
if test -f ocamldep; then mv -f ocamldep ocamldep.bak; else :; fi
rm -f ocamldep.opt
install::
cp ocamldep $(BINDIR)/ocamldep$(EXE)
if test -f ocamldep.opt; \
then cp ocamldep.opt $(BINDIR)/ocamldep.opt$(EXE); else :; fi
# The profiler
CSLPROF=ocamlprof.cmo
CSLPROF_IMPORTS=misc.cmo config.cmo clflags.cmo terminfo.cmo \
linenum.cmo warnings.cmo location.cmo longident.cmo \
syntaxerr.cmo parser.cmo lexer.cmo parse.cmo
ocamlprof: $(CSLPROF) profiling.cmo
$(CAMLC) $(LINKFLAGS) -o ocamlprof $(CSLPROF_IMPORTS) $(CSLPROF)
ocamlcp: ocamlcp.cmo
$(CAMLC) $(LINKFLAGS) -o ocamlcp warnings.cmo main_args.cmo ocamlcp.cmo
install::
cp ocamlprof $(BINDIR)/ocamlprof$(EXE)
cp ocamlcp $(BINDIR)/ocamlcp$(EXE)
cp profiling.cmi profiling.cmo $(LIBDIR)
clean::
rm -f ocamlprof ocamlcp
install::
cp ocamlmktop $(BINDIR)/ocamlmktop$(EXE)
clean::
rm -f ocamlmktop
# To help building mixed-mode libraries (Caml + C)
ocamlmklib: myocamlbuild_config.cmo ocamlmklib.cmo
$(CAMLC) $(LINKFLAGS) -o ocamlmklib myocamlbuild_config.cmo \
ocamlmklib.cmo
ocamlmklib.cmo: myocamlbuild_config.cmi
myocamlbuild_config.cmi: myocamlbuild_config.cmo
myocamlbuild_config.ml: ../config/Makefile ../build/mkmyocamlbuild_config.sh
../build/mkmyocamlbuild_config.sh
cp ../myocamlbuild_config.ml .
install::
cp ocamlmklib $(BINDIR)/ocamlmklib$(EXE)
clean::
rm -f ocamlmklib
ocamlmklib.ml: ocamlmklib.mlp ../config/Makefile
echo '(* THIS FILE IS GENERATED FROM ocamlmklib.mlp *)' >ocamlmklib.ml
sed -e "s|%%BINDIR%%|$(BINDIR)|" \
-e "s|%%SUPPORTS_SHARED_LIBRARIES%%|$(SUPPORTS_SHARED_LIBRARIES)|" \
-e "s|%%MKSHAREDLIB%%|$(MKSHAREDLIB)|" \
-e "s|%%BYTECCRPATH%%|$(BYTECCRPATH)|" \
-e "s|%%NATIVECCRPATH%%|$(NATIVECCRPATH)|" \
-e "s|%%MKSHAREDLIBRPATH%%|$(MKSHAREDLIBRPATH)|" \
-e "s|%%RANLIB%%|$(RANLIB)|" \
ocamlmklib.mlp >> ocamlmklib.ml
beforedepend:: ocamlmklib.ml
clean::
rm -f ocamlmklib.ml
# To make custom toplevels (see Makefile/Makefile.nt)
install::
cp ocamlmktop $(BINDIR)/ocamlmktop$(EXE)
clean::
rm -f ocamlmktop
# Converter olabl/ocaml 2.99 to ocaml 3
OCAML299TO3= lexer299.cmo ocaml299to3.cmo
LIBRARY3= misc.cmo warnings.cmo linenum.cmo location.cmo
ocaml299to3: $(OCAML299TO3)
$(CAMLC) $(LINKFLAGS) -o ocaml299to3 $(LIBRARY3) $(OCAML299TO3)
lexer299.ml: lexer299.mll
$(CAMLLEX) lexer299.mll
#install::
# cp ocaml299to3 $(BINDIR)/ocaml299to3$(EXE)
clean::
rm -f ocaml299to3 lexer299.ml
# Label remover for interface files (upgrade 3.02 to 3.03)
SCRAPELABELS= lexer301.cmo scrapelabels.cmo
scrapelabels: $(SCRAPELABELS)
$(CAMLC) $(LINKFLAGS) -o scrapelabels $(LIBRARY3) $(SCRAPELABELS)
lexer301.ml: lexer301.mll
$(CAMLLEX) lexer301.mll
#install::
# cp scrapelabels $(LIBDIR)
clean::
rm -f scrapelabels lexer301.ml
# Insert labels following an interface file (upgrade 3.02 to 3.03)
ADDLABELS_IMPORTS=misc.cmo config.cmo clflags.cmo terminfo.cmo \
linenum.cmo warnings.cmo location.cmo longident.cmo \
syntaxerr.cmo parser.cmo lexer.cmo parse.cmo
addlabels: addlabels.cmo
$(CAMLC) $(LINKFLAGS) -w sl -o addlabels \
$(ADDLABELS_IMPORTS) addlabels.cmo
#install::
# cp addlabels $(LIBDIR)
clean::
rm -f addlabels
# The preprocessor for asm generators
CVT_EMIT=cvt_emit.cmo
cvt_emit: $(CVT_EMIT)
$(CAMLC) $(LINKFLAGS) -o cvt_emit $(CVT_EMIT)
# cvt_emit is precious: sometimes we are stuck in the middle of a
# bootstrap and we need to remake the dependencies
clean::
if test -f cvt_emit; then mv -f cvt_emit cvt_emit.bak; else :; fi
cvt_emit.ml: cvt_emit.mll
$(CAMLLEX) cvt_emit.mll
clean::
rm -f cvt_emit.ml
beforedepend:: cvt_emit.ml
# The bytecode disassembler
DUMPOBJ=opnames.cmo dumpobj.cmo
dumpobj: $(DUMPOBJ)
$(CAMLC) $(LINKFLAGS) -o dumpobj \
misc.cmo tbl.cmo config.cmo ident.cmo \
opcodes.cmo bytesections.cmo $(DUMPOBJ)
clean::
rm -f dumpobj
opnames.ml: ../byterun/instruct.h
unset LC_ALL || : ; \
unset LC_CTYPE || : ; \
unset LC_COLLATE LANG || : ; \
sed -e '/\/\*/d' \
-e '/^#/d' \
-e 's/enum \(.*\) {/let names_of_\1 = [|/' \
-e 's/};$$/ |]/' \
-e 's/\([A-Z][A-Z_0-9a-z]*\)/"\1"/g' \
-e 's/,/;/g' \
../byterun/instruct.h > opnames.ml
clean::
rm -f opnames.ml
beforedepend:: opnames.ml
# Display info on compiled files
objinfo_lib.cma: ocamlmklib objinfo_lib.cmo objinfo_stubs$(EXT_OBJ)
../boot/ocamlrun ./ocamlmklib -ocamlc '$(CAMLC)' \
-o objinfo_lib objinfo_lib.cmo objinfo_stubs$(EXT_OBJ) $(LIBBFD_LINK)
objinfo_stubs$(EXT_OBJ): objinfo_stubs.c
$(BYTECC) $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS) -c objinfo_stubs.c
OBJINFO=../utils/config.cmo ../bytecomp/bytesections.cmo \
objinfo_lib.cma objinfo.cmo
objinfo: $(OBJINFO)
$(CAMLC) -o objinfo $(OBJINFO)
install::
cp objinfo $(BINDIR)/ocamlobjinfo$(EXE)
if test -f dllobjinfo_lib$(EXT_DLL); then \
cp dllobjinfo_lib$(EXT_DLL) $(STUBLIBDIR)/; fi
clean::
rm -f objinfo
rm -f objinfo_stubs$(EXT_OBJ) libobjinfo_lib$(EXT_LIB) dllobjinfo_lib$(EXT_DLL)
# Scan object files for required primitives
PRIMREQ=primreq.cmo
primreq: $(PRIMREQ)
$(CAMLC) $(LINKFLAGS) -o primreq config.cmo $(PRIMREQ)
clean::
rm -f primreq
# Common stuff
.SUFFIXES:
.SUFFIXES: .ml .cmo .mli .cmi .cmx
.ml.cmo:
$(CAMLC) -c $(COMPFLAGS) $<
.mli.cmi:
$(CAMLC) -c $(COMPFLAGS) $<
.ml.cmx:
$(CAMLOPT) $(COMPFLAGS) -c $<
clean::
rm -f *.cmo *.cmi *.cma
depend: beforedepend
$(CAMLRUN) ./ocamldep $(INCLUDES) *.mli *.ml > .depend
.PHONY: clean install beforedepend depend
include .depend
|