2007-11-06 07:16:56 -08:00
|
|
|
#########################################################################
|
|
|
|
# #
|
2011-07-27 07:17:02 -07:00
|
|
|
# OCaml #
|
2007-11-06 07:16:56 -08:00
|
|
|
# #
|
|
|
|
# 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. #
|
|
|
|
# #
|
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
include ../config/Makefile
|
|
|
|
|
|
|
|
CAMLRUN=../boot/ocamlrun
|
2009-12-09 01:52:47 -08:00
|
|
|
CAMLC=$(CAMLRUN) ../boot/ocamlc -strict-sequence -nostdlib -I ../boot
|
2007-11-06 07:16:56 -08:00
|
|
|
CAMLOPT=$(CAMLRUN) ../ocamlopt -nostdlib -I ../stdlib
|
|
|
|
CAMLLEX=$(CAMLRUN) ../boot/ocamllex
|
|
|
|
INCLUDES=-I ../utils -I ../parsing -I ../typing -I ../bytecomp -I ../asmcomp \
|
2013-03-29 04:14:25 -07:00
|
|
|
-I ../driver -I ../toplevel
|
2012-12-19 01:25:21 -08:00
|
|
|
COMPFLAGS= -w +32+33+34+35+36+37+38+39 -warn-error A $(INCLUDES)
|
2007-11-06 07:16:56 -08:00
|
|
|
LINKFLAGS=$(INCLUDES)
|
|
|
|
|
2012-07-26 12:21:54 -07:00
|
|
|
all: ocamldep ocamlprof ocamlcp ocamloptp ocamlmktop ocamlmklib dumpobj \
|
2013-04-02 08:33:35 -07:00
|
|
|
objinfo read_cmt
|
|
|
|
|
|
|
|
moretools: ocamlast
|
2012-05-30 07:52:37 -07:00
|
|
|
|
2013-01-16 08:10:29 -08:00
|
|
|
all: tast_iter.cmo
|
2012-11-08 06:27:22 -08:00
|
|
|
|
2010-05-19 04:29:38 -07:00
|
|
|
# scrapelabels addlabels
|
|
|
|
|
2013-04-02 08:33:35 -07:00
|
|
|
.PHONY: all moretools
|
2007-11-06 07:16:56 -08:00
|
|
|
|
2012-11-06 08:55:18 -08:00
|
|
|
opt.opt: ocamldep.opt read_cmt.opt
|
2007-11-22 14:14:43 -08:00
|
|
|
.PHONY: opt.opt
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
# The dependency generator
|
|
|
|
|
|
|
|
CAMLDEP_OBJ=depend.cmo ocamldep.cmo
|
|
|
|
CAMLDEP_IMPORTS=misc.cmo config.cmo clflags.cmo terminfo.cmo \
|
2011-08-04 07:59:13 -07:00
|
|
|
warnings.cmo location.cmo longident.cmo \
|
2013-03-08 06:59:45 -08:00
|
|
|
syntaxerr.cmo ast_helper.cmo parser.cmo lexer.cmo parse.cmo \
|
2012-07-24 09:24:44 -07:00
|
|
|
ccomp.cmo pparse.cmo
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
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 \
|
2011-08-04 07:59:13 -07:00
|
|
|
warnings.cmo location.cmo longident.cmo \
|
2013-03-08 06:59:45 -08:00
|
|
|
syntaxerr.cmo ast_helper.cmo parser.cmo lexer.cmo parse.cmo
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
ocamlprof: $(CSLPROF) profiling.cmo
|
|
|
|
$(CAMLC) $(LINKFLAGS) -o ocamlprof $(CSLPROF_IMPORTS) $(CSLPROF)
|
|
|
|
|
|
|
|
ocamlcp: ocamlcp.cmo
|
2010-05-04 11:44:38 -07:00
|
|
|
$(CAMLC) $(LINKFLAGS) -o ocamlcp warnings.cmo main_args.cmo ocamlcp.cmo
|
2007-11-06 07:16:56 -08:00
|
|
|
|
2012-07-26 12:21:54 -07:00
|
|
|
ocamloptp: ocamloptp.cmo
|
|
|
|
$(CAMLC) $(LINKFLAGS) -o ocamloptp warnings.cmo main_args.cmo \
|
|
|
|
ocamloptp.cmo
|
|
|
|
|
|
|
|
opt:: profiling.cmx
|
|
|
|
|
2007-11-06 07:16:56 -08:00
|
|
|
install::
|
|
|
|
cp ocamlprof $(BINDIR)/ocamlprof$(EXE)
|
|
|
|
cp ocamlcp $(BINDIR)/ocamlcp$(EXE)
|
2012-07-26 12:21:54 -07:00
|
|
|
cp ocamloptp $(BINDIR)/ocamloptp$(EXE)
|
2007-11-06 07:16:56 -08:00
|
|
|
cp profiling.cmi profiling.cmo $(LIBDIR)
|
|
|
|
|
2012-07-26 12:21:54 -07:00
|
|
|
installopt::
|
|
|
|
cp profiling.cmx profiling.o $(LIBDIR)
|
|
|
|
|
2007-11-06 07:16:56 -08:00
|
|
|
clean::
|
2012-07-26 12:21:54 -07:00
|
|
|
rm -f ocamlprof ocamlcp ocamloptp
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
|
2012-02-10 08:15:24 -08:00
|
|
|
# To help building mixed-mode libraries (OCaml + C)
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
ocamlmklib: myocamlbuild_config.cmo ocamlmklib.cmo
|
2007-11-22 14:14:43 -08:00
|
|
|
$(CAMLC) $(LINKFLAGS) -o ocamlmklib myocamlbuild_config.cmo \
|
|
|
|
ocamlmklib.cmo
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
ocamlmklib.cmo: myocamlbuild_config.cmi
|
2007-11-22 14:14:43 -08:00
|
|
|
|
|
|
|
myocamlbuild_config.cmi: myocamlbuild_config.cmo
|
|
|
|
|
2007-11-15 05:21:15 -08:00
|
|
|
myocamlbuild_config.ml: ../config/Makefile ../build/mkmyocamlbuild_config.sh
|
2007-11-06 07:16:56 -08:00
|
|
|
../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)|" \
|
2010-01-22 04:48:24 -08:00
|
|
|
-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
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
beforedepend:: ocamlmklib.ml
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f ocamlmklib.ml
|
|
|
|
|
|
|
|
|
|
|
|
# Converter olabl/ocaml 2.99 to ocaml 3
|
|
|
|
|
|
|
|
OCAML299TO3= lexer299.cmo ocaml299to3.cmo
|
2011-08-04 07:59:13 -07:00
|
|
|
LIBRARY3= misc.cmo warnings.cmo location.cmo
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2010-05-19 04:29:38 -07:00
|
|
|
#install::
|
|
|
|
# cp scrapelabels $(LIBDIR)
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
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 \
|
2011-08-04 07:59:13 -07:00
|
|
|
warnings.cmo location.cmo longident.cmo \
|
2013-03-08 06:59:45 -08:00
|
|
|
syntaxerr.cmo ast_helper.cmo parser.cmo lexer.cmo parse.cmo
|
2007-11-06 07:16:56 -08:00
|
|
|
|
2009-12-03 08:05:49 -08:00
|
|
|
addlabels: addlabels.cmo
|
2007-11-06 07:16:56 -08:00
|
|
|
$(CAMLC) $(LINKFLAGS) -w sl -o addlabels \
|
2009-12-03 08:05:49 -08:00
|
|
|
$(ADDLABELS_IMPORTS) addlabels.cmo
|
2007-11-06 07:16:56 -08:00
|
|
|
|
2010-05-19 04:29:38 -07:00
|
|
|
#install::
|
|
|
|
# cp addlabels $(LIBDIR)
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2012-05-30 07:52:37 -07:00
|
|
|
|
|
|
|
# Reading cmt files
|
|
|
|
|
|
|
|
READ_CMT= \
|
|
|
|
../utils/misc.cmo \
|
|
|
|
../utils/warnings.cmo \
|
|
|
|
../utils/tbl.cmo \
|
|
|
|
../utils/consistbl.cmo \
|
|
|
|
../utils/config.cmo \
|
|
|
|
../utils/clflags.cmo \
|
|
|
|
../parsing/location.cmo \
|
|
|
|
../parsing/longident.cmo \
|
|
|
|
../parsing/lexer.cmo \
|
2012-10-17 08:50:07 -07:00
|
|
|
../parsing/pprintast.cmo \
|
2013-03-08 06:59:45 -08:00
|
|
|
../parsing/ast_helper.cmo \
|
2012-05-30 07:52:37 -07:00
|
|
|
../typing/ident.cmo \
|
|
|
|
../typing/path.cmo \
|
|
|
|
../typing/types.cmo \
|
|
|
|
../typing/typedtree.cmo \
|
|
|
|
../typing/btype.cmo \
|
|
|
|
../typing/subst.cmo \
|
|
|
|
../typing/predef.cmo \
|
|
|
|
../typing/datarepr.cmo \
|
|
|
|
../typing/cmi_format.cmo \
|
|
|
|
../typing/env.cmo \
|
|
|
|
../typing/ctype.cmo \
|
|
|
|
../typing/oprint.cmo \
|
|
|
|
../typing/primitive.cmo \
|
|
|
|
../typing/printtyp.cmo \
|
2012-11-08 02:19:36 -08:00
|
|
|
../typing/mtype.cmo \
|
|
|
|
../typing/envaux.cmo \
|
2012-07-12 04:02:18 -07:00
|
|
|
../typing/typedtreeMap.cmo \
|
|
|
|
../typing/typedtreeIter.cmo \
|
2012-05-30 07:52:37 -07:00
|
|
|
../typing/cmt_format.cmo \
|
|
|
|
../typing/stypes.cmo \
|
|
|
|
\
|
2012-10-17 08:50:07 -07:00
|
|
|
untypeast.cmo \
|
2012-11-08 09:21:27 -08:00
|
|
|
tast_iter.cmo \
|
2012-05-30 07:52:37 -07:00
|
|
|
cmt2annot.cmo read_cmt.cmo
|
|
|
|
|
|
|
|
read_cmt: $(READ_CMT)
|
|
|
|
$(CAMLC) $(LINKFLAGS) -o read_cmt $(READ_CMT)
|
|
|
|
|
2012-11-06 08:55:18 -08:00
|
|
|
read_cmt.opt: $(READ_CMT:.cmo=.cmx)
|
|
|
|
$(CAMLOPT) $(LINKFLAGS) -o read_cmt.opt $(READ_CMT:.cmo=.cmx)
|
|
|
|
|
2012-05-30 07:52:37 -07:00
|
|
|
clean::
|
2012-11-06 08:55:18 -08:00
|
|
|
rm -f read_cmt read_cmt.opt
|
2012-05-30 07:52:37 -07:00
|
|
|
|
|
|
|
beforedepend::
|
|
|
|
|
2007-11-06 07:16:56 -08:00
|
|
|
# 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' \
|
2010-01-22 04:48:24 -08:00
|
|
|
-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
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f opnames.ml
|
|
|
|
|
|
|
|
beforedepend:: opnames.ml
|
|
|
|
|
2010-05-19 04:29:38 -07:00
|
|
|
# Display info on compiled files
|
2007-11-06 07:16:56 -08:00
|
|
|
|
2010-05-24 07:27:50 -07:00
|
|
|
objinfo_helper$(EXE): objinfo_helper.c ../config/s.h
|
|
|
|
$(BYTECC) -o objinfo_helper$(EXE) $(BYTECCCOMPOPTS) \
|
|
|
|
objinfo_helper.c $(LIBBFD_LINK)
|
2007-11-06 07:16:56 -08:00
|
|
|
|
2012-05-30 07:52:37 -07:00
|
|
|
OBJINFO=../utils/misc.cmo ../utils/config.cmo \
|
|
|
|
../utils/warnings.cmo ../parsing/location.cmo \
|
|
|
|
../typing/cmi_format.cmo ../bytecomp/bytesections.cmo \
|
2010-05-24 07:27:50 -07:00
|
|
|
objinfo.cmo
|
2007-11-06 07:16:56 -08:00
|
|
|
|
2010-05-24 07:27:50 -07:00
|
|
|
objinfo: objinfo_helper$(EXE) $(OBJINFO)
|
2010-05-19 04:29:38 -07:00
|
|
|
$(CAMLC) -o objinfo $(OBJINFO)
|
|
|
|
|
|
|
|
install::
|
|
|
|
cp objinfo $(BINDIR)/ocamlobjinfo$(EXE)
|
2010-05-24 07:27:50 -07:00
|
|
|
cp objinfo_helper$(EXE) $(LIBDIR)/objinfo_helper$(EXE)
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
clean::
|
2010-05-24 07:27:50 -07:00
|
|
|
rm -f objinfo objinfo_helper$(EXE)
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
# Scan object files for required primitives
|
|
|
|
|
|
|
|
PRIMREQ=primreq.cmo
|
|
|
|
|
|
|
|
primreq: $(PRIMREQ)
|
|
|
|
$(CAMLC) $(LINKFLAGS) -o primreq config.cmo $(PRIMREQ)
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f primreq
|
|
|
|
|
2013-03-29 04:14:25 -07:00
|
|
|
# Dump the Parsetree representation of OCaml code, in OCaml syntax
|
|
|
|
|
|
|
|
OCAMLAST=dump_ast.cmo
|
|
|
|
|
|
|
|
ocamlast: $(OCAMLAST)
|
|
|
|
$(CAMLC) $(LINKFLAGS) -o ocamlast ../compilerlibs/ocamlcommon.cma ../compilerlibs/ocamlbytecomp.cma ../compilerlibs/ocamltoplevel.cma $(OCAMLAST)
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -rf ocamlast
|
|
|
|
|
|
|
|
install::
|
|
|
|
cp ocamlast $(BINDIR)/ocamlast$(EXE)
|
|
|
|
|
2007-11-06 07:16:56 -08:00
|
|
|
# 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::
|
2010-08-02 07:37:22 -07:00
|
|
|
rm -f *.cmo *.cmi *.cma *.dll *.so *.lib *.a
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
depend: beforedepend
|
|
|
|
$(CAMLRUN) ./ocamldep $(INCLUDES) *.mli *.ml > .depend
|
|
|
|
|
2007-11-22 14:14:43 -08:00
|
|
|
.PHONY: clean install beforedepend depend
|
|
|
|
|
2007-11-06 07:16:56 -08:00
|
|
|
include .depend
|