1999-11-17 10:59:06 -08:00
|
|
|
#########################################################################
|
|
|
|
# #
|
|
|
|
# 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$
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
# The main Makefile
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
include config/Makefile
|
|
|
|
|
1996-04-30 07:53:58 -07:00
|
|
|
CAMLC=boot/ocamlrun boot/ocamlc -I boot
|
|
|
|
CAMLOPT=boot/ocamlrun ./ocamlopt -I stdlib
|
1995-05-04 03:15:53 -07:00
|
|
|
COMPFLAGS=$(INCLUDES)
|
|
|
|
LINKFLAGS=
|
1996-04-30 07:53:58 -07:00
|
|
|
CAMLYACC=boot/ocamlyacc
|
1998-04-22 23:40:43 -07:00
|
|
|
YACCFLAGS=-v
|
1996-04-30 07:53:58 -07:00
|
|
|
CAMLLEX=boot/ocamlrun boot/ocamllex
|
|
|
|
CAMLDEP=boot/ocamlrun tools/ocamldep
|
1995-05-04 03:15:53 -07:00
|
|
|
DEPFLAGS=$(INCLUDES)
|
1996-04-30 07:53:58 -07:00
|
|
|
CAMLRUN=byterun/ocamlrun
|
1996-02-13 08:29:09 -08:00
|
|
|
SHELL=/bin/sh
|
1996-11-07 02:54:28 -08:00
|
|
|
MKDIR=mkdir -p
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-07-02 09:40:47 -07:00
|
|
|
INCLUDES=-I utils -I parsing -I typing -I bytecomp -I asmcomp -I driver -I toplevel
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2000-04-21 01:09:42 -07:00
|
|
|
UTILS=utils/misc.cmo utils/tbl.cmo utils/config.cmo \
|
1998-11-05 00:01:06 -08:00
|
|
|
utils/clflags.cmo utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2000-02-11 07:09:27 -08:00
|
|
|
OPTUTILS=$(UTILS)
|
1997-03-04 02:19:15 -08:00
|
|
|
|
1997-02-04 07:40:22 -08:00
|
|
|
PARSING=parsing/linenum.cmo parsing/location.cmo parsing/longident.cmo \
|
1997-08-22 01:55:41 -07:00
|
|
|
parsing/syntaxerr.cmo parsing/pstream.cmo parsing/parser.cmo \
|
1999-11-29 11:04:43 -08:00
|
|
|
parsing/lexer.cmo parsing/parse.cmo parsing/printast.cmo
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-07-27 10:38:09 -07:00
|
|
|
TYPING=typing/ident.cmo typing/path.cmo \
|
1996-09-23 04:29:13 -07:00
|
|
|
typing/primitive.cmo typing/types.cmo \
|
1997-03-24 12:11:22 -08:00
|
|
|
typing/btype.cmo \
|
1996-04-22 04:15:41 -07:00
|
|
|
typing/subst.cmo typing/predef.cmo \
|
|
|
|
typing/datarepr.cmo typing/env.cmo \
|
1998-06-24 12:22:26 -07:00
|
|
|
typing/typedtree.cmo typing/ctype.cmo \
|
|
|
|
typing/printtyp.cmo typing/includeclass.cmo \
|
1996-04-22 04:15:41 -07:00
|
|
|
typing/mtype.cmo typing/includecore.cmo \
|
|
|
|
typing/includemod.cmo typing/parmatch.cmo \
|
1995-05-04 03:15:53 -07:00
|
|
|
typing/typetexp.cmo typing/typecore.cmo \
|
1996-04-22 04:15:41 -07:00
|
|
|
typing/typedecl.cmo typing/typeclass.cmo \
|
|
|
|
typing/typemod.cmo
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-07-02 09:40:47 -07:00
|
|
|
COMP=bytecomp/lambda.cmo bytecomp/printlambda.cmo \
|
1998-04-06 02:24:23 -07:00
|
|
|
bytecomp/typeopt.cmo bytecomp/matching.cmo \
|
|
|
|
bytecomp/translobj.cmo bytecomp/translcore.cmo \
|
1996-04-22 04:15:41 -07:00
|
|
|
bytecomp/translclass.cmo bytecomp/translmod.cmo \
|
1995-12-15 01:55:24 -08:00
|
|
|
bytecomp/simplif.cmo bytecomp/runtimedef.cmo
|
1995-07-02 09:40:47 -07:00
|
|
|
|
1995-07-12 08:30:16 -07:00
|
|
|
BYTECOMP=bytecomp/meta.cmo bytecomp/instruct.cmo bytecomp/bytegen.cmo \
|
1995-05-04 03:15:53 -07:00
|
|
|
bytecomp/printinstr.cmo bytecomp/opcodes.cmo bytecomp/emitcode.cmo \
|
2000-03-05 11:18:50 -08:00
|
|
|
bytecomp/bytesections.cmo bytecomp/symtable.cmo \
|
|
|
|
bytecomp/bytelibrarian.cmo bytecomp/bytelink.cmo
|
1995-07-02 09:40:47 -07:00
|
|
|
|
|
|
|
ASMCOMP=asmcomp/arch.cmo asmcomp/cmm.cmo asmcomp/printcmm.cmo \
|
1995-07-25 04:36:29 -07:00
|
|
|
asmcomp/reg.cmo asmcomp/mach.cmo asmcomp/proc.cmo \
|
1995-07-02 09:40:47 -07:00
|
|
|
asmcomp/clambda.cmo asmcomp/compilenv.cmo \
|
|
|
|
asmcomp/closure.cmo asmcomp/cmmgen.cmo \
|
1997-07-24 04:49:12 -07:00
|
|
|
asmcomp/printmach.cmo asmcomp/selectgen.cmo asmcomp/selection.cmo \
|
1999-05-15 08:04:46 -07:00
|
|
|
asmcomp/comballoc.cmo asmcomp/liveness.cmo \
|
|
|
|
asmcomp/spill.cmo asmcomp/split.cmo \
|
1997-07-24 04:49:12 -07:00
|
|
|
asmcomp/interf.cmo asmcomp/coloring.cmo \
|
|
|
|
asmcomp/reloadgen.cmo asmcomp/reload.cmo \
|
|
|
|
asmcomp/printlinear.cmo asmcomp/linearize.cmo \
|
|
|
|
asmcomp/schedgen.cmo asmcomp/scheduling.cmo \
|
1995-08-13 02:31:50 -07:00
|
|
|
asmcomp/emitaux.cmo asmcomp/emit.cmo asmcomp/asmgen.cmo \
|
1995-07-11 11:02:00 -07:00
|
|
|
asmcomp/asmlink.cmo asmcomp/asmlibrarian.cmo
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1999-02-03 08:04:29 -08:00
|
|
|
DRIVER=driver/errors.cmo driver/compile.cmo driver/main_args.cmo \
|
|
|
|
driver/main.cmo
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-07-02 09:40:47 -07:00
|
|
|
OPTDRIVER=driver/opterrors.cmo driver/optcompile.cmo driver/optmain.cmo
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
TOPLEVEL=driver/errors.cmo driver/compile.cmo \
|
1997-03-22 12:25:59 -08:00
|
|
|
toplevel/genprintval.cmo \
|
1995-09-14 04:51:35 -07:00
|
|
|
toplevel/printval.cmo toplevel/toploop.cmo \
|
|
|
|
toplevel/trace.cmo toplevel/topdirs.cmo
|
1995-08-28 04:44:00 -07:00
|
|
|
|
1999-11-30 08:07:38 -08:00
|
|
|
TOPLEVELLIB=toplevel/toplevellib.cma
|
1995-08-28 04:44:00 -07:00
|
|
|
TOPLEVELMAIN=toplevel/topmain.cmo
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-07-02 09:40:47 -07:00
|
|
|
COMPOBJS=$(UTILS) $(PARSING) $(TYPING) $(COMP) $(BYTECOMP) $(DRIVER)
|
|
|
|
|
1995-08-28 04:44:00 -07:00
|
|
|
TOPLIB=$(UTILS) $(PARSING) $(TYPING) $(COMP) $(BYTECOMP) $(TOPLEVEL)
|
|
|
|
|
1999-11-30 08:07:38 -08:00
|
|
|
TOPOBJS=toplevel/toplevellib.cma $(TOPLEVELMAIN)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1997-03-04 02:19:15 -08:00
|
|
|
OPTOBJS=$(OPTUTILS) $(PARSING) $(TYPING) $(COMP) $(ASMCOMP) $(OPTDRIVER)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2000-04-21 04:55:31 -07:00
|
|
|
EXPUNGEOBJS=utils/misc.cmo utils/tbl.cmo \
|
1995-05-04 03:15:53 -07:00
|
|
|
utils/config.cmo utils/clflags.cmo \
|
1998-06-24 12:22:26 -07:00
|
|
|
typing/ident.cmo typing/path.cmo typing/types.cmo typing/btype.cmo \
|
2000-03-05 11:18:50 -08:00
|
|
|
typing/predef.cmo bytecomp/runtimedef.cmo bytecomp/bytesections.cmo \
|
|
|
|
bytecomp/symtable.cmo toplevel/expunge.cmo
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1999-03-04 05:45:11 -08:00
|
|
|
PERVASIVES=arg array buffer callback char digest filename format gc hashtbl \
|
1997-03-05 02:47:54 -08:00
|
|
|
lexing list map obj parsing pervasives printexc printf queue random \
|
1997-12-09 01:13:53 -08:00
|
|
|
set sort stack string stream sys oo genlex topdirs toploop weak lazy \
|
2000-02-16 19:23:40 -08:00
|
|
|
marshal int32 int64 nativeint
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
# Recompile the system using the bootstrap compiler
|
1997-02-23 08:29:36 -08:00
|
|
|
all: runtime ocamlc ocamllex ocamlyacc ocamltools library ocaml \
|
|
|
|
otherlibraries $(DEBUGGER)
|
1995-06-18 07:43:13 -07:00
|
|
|
|
1996-04-30 07:53:58 -07:00
|
|
|
# The compilation of ocaml will fail if the runtime has changed.
|
1995-06-18 07:43:13 -07:00
|
|
|
# Never mind, just do make bootstrap to reach fixpoint again.
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
# Compile everything the first time
|
1997-02-16 05:36:42 -08:00
|
|
|
world: coldstart all
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-06-18 07:43:13 -07:00
|
|
|
# Complete bootstrapping cycle
|
1995-07-02 09:40:47 -07:00
|
|
|
bootstrap:
|
1995-07-07 05:04:35 -07:00
|
|
|
# Save the original bootstrap compiler
|
1995-07-02 09:40:47 -07:00
|
|
|
$(MAKE) backup
|
1995-07-07 05:04:35 -07:00
|
|
|
# Promote the new compiler but keep the old runtime
|
1996-04-30 07:53:58 -07:00
|
|
|
# This compiler runs on boot/ocamlrun and produces bytecode for
|
|
|
|
# byterun/ocamlrun
|
1995-07-02 09:40:47 -07:00
|
|
|
$(MAKE) promote-cross
|
1996-04-30 07:53:58 -07:00
|
|
|
# Rebuild ocamlc and ocamllex (run on byterun/ocamlrun)
|
1997-02-16 05:36:42 -08:00
|
|
|
$(MAKE) partialclean
|
1996-04-30 07:53:58 -07:00
|
|
|
$(MAKE) ocamlc ocamllex
|
|
|
|
# Rebuild the library (using byterun/ocamlrun ./ocamlc)
|
1995-07-02 09:40:47 -07:00
|
|
|
$(MAKE) library-cross
|
1995-07-07 05:04:35 -07:00
|
|
|
# Promote the new compiler and the new runtime
|
1995-07-02 09:40:47 -07:00
|
|
|
$(MAKE) promote
|
1996-04-30 07:53:58 -07:00
|
|
|
# Rebuild everything, including ocaml and the tools
|
1997-02-16 05:36:42 -08:00
|
|
|
$(MAKE) partialclean
|
1995-07-02 09:40:47 -07:00
|
|
|
$(MAKE) all
|
1995-07-07 05:04:35 -07:00
|
|
|
# Check if fixpoint reached
|
1995-07-02 09:40:47 -07:00
|
|
|
$(MAKE) compare
|
|
|
|
|
1996-04-30 07:53:58 -07:00
|
|
|
LIBFILES=stdlib.cma std_exit.cmo *.cmi camlheader
|
1995-10-23 09:54:03 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
# Start up the system from the distribution compiler
|
|
|
|
coldstart:
|
|
|
|
cd byterun; $(MAKE) all
|
1996-04-30 07:53:58 -07:00
|
|
|
cp byterun/ocamlrun boot/ocamlrun
|
1995-05-04 03:15:53 -07:00
|
|
|
cd yacc; $(MAKE) all
|
1996-04-30 07:53:58 -07:00
|
|
|
cp yacc/ocamlyacc boot/ocamlyacc
|
|
|
|
cd stdlib; $(MAKE) COMPILER=../boot/ocamlc all
|
1995-10-23 09:54:03 -07:00
|
|
|
cd stdlib; cp $(LIBFILES) ../boot
|
1997-02-25 06:39:44 -08:00
|
|
|
if test -f boot/libcamlrun.a; then :; else \
|
|
|
|
ln -s ../byterun/libcamlrun.a boot/libcamlrun.a; fi
|
1999-11-30 09:30:38 -08:00
|
|
|
if test -d stdlib/caml; then :; else \
|
|
|
|
ln -s ../byterun stdlib/caml; fi
|
1995-05-04 03:15:53 -07:00
|
|
|
|
2000-04-05 11:30:22 -07:00
|
|
|
# Build the core system: the minimum needed to make depend and bootstrap
|
|
|
|
core : runtime ocamlc ocamllex ocamlyacc ocamltools library
|
|
|
|
|
1995-06-18 07:43:13 -07:00
|
|
|
# Save the current bootstrap compiler
|
1997-07-24 04:49:12 -07:00
|
|
|
MAXSAVED=boot/Saved/Saved.prev/Saved.prev/Saved.prev/Saved.prev/Saved.prev
|
1995-06-18 07:43:13 -07:00
|
|
|
backup:
|
1995-09-11 07:57:21 -07:00
|
|
|
if test -d boot/Saved; then : ; else mkdir boot/Saved; fi
|
1997-07-24 04:49:12 -07:00
|
|
|
if test -d $(MAXSAVED); then rm -r $(MAXSAVED); else : ; fi
|
1995-05-04 03:15:53 -07:00
|
|
|
mv boot/Saved boot/Saved.prev
|
|
|
|
mkdir boot/Saved
|
|
|
|
mv boot/Saved.prev boot/Saved/Saved.prev
|
1996-04-30 07:53:58 -07:00
|
|
|
cp boot/ocamlrun boot/Saved
|
|
|
|
mv boot/ocamlc boot/ocamllex boot/ocamlyacc boot/Saved
|
1995-10-23 09:54:03 -07:00
|
|
|
cd boot; cp $(LIBFILES) Saved
|
1995-06-18 07:43:13 -07:00
|
|
|
|
|
|
|
# Promote the newly compiled system to the rank of cross compiler
|
|
|
|
# (Runs on the old runtime, produces code for the new runtime)
|
|
|
|
promote-cross:
|
1996-04-30 07:53:58 -07:00
|
|
|
cp ocamlc boot/ocamlc
|
|
|
|
cp lex/ocamllex boot/ocamllex
|
|
|
|
cp yacc/ocamlyacc boot/ocamlyacc
|
1995-10-23 09:54:03 -07:00
|
|
|
cd stdlib; cp $(LIBFILES) ../boot
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-06-18 07:43:13 -07:00
|
|
|
# Promote the newly compiled system to the rank of bootstrap compiler
|
|
|
|
# (Runs on the new runtime, produces code for the new runtime)
|
|
|
|
promote: promote-cross
|
1996-04-30 07:53:58 -07:00
|
|
|
cp byterun/ocamlrun boot/ocamlrun
|
1995-06-18 07:43:13 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
# Restore the saved bootstrap compiler if a problem arises
|
|
|
|
restore:
|
|
|
|
mv boot/Saved/* boot
|
|
|
|
rmdir boot/Saved
|
|
|
|
mv boot/Saved.prev boot/Saved
|
|
|
|
|
|
|
|
# Check if fixpoint reached
|
|
|
|
compare:
|
1996-04-30 07:53:58 -07:00
|
|
|
@if cmp boot/ocamlc ocamlc && cmp boot/ocamllex lex/ocamllex; \
|
1995-05-04 03:15:53 -07:00
|
|
|
then echo "Fixpoint reached, bootstrap succeeded."; \
|
|
|
|
else echo "Fixpoint not reached, try one more bootstrapping cycle."; \
|
|
|
|
fi
|
|
|
|
|
1995-05-04 04:48:01 -07:00
|
|
|
# Remove old bootstrap compilers
|
|
|
|
cleanboot:
|
|
|
|
rm -rf boot/Saved/Saved.prev/*
|
|
|
|
|
1995-07-21 02:03:58 -07:00
|
|
|
# Compile the native-code compiler
|
1996-04-30 07:53:58 -07:00
|
|
|
opt: runtimeopt ocamlopt libraryopt otherlibrariesopt
|
1995-07-21 02:03:58 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
# Installation
|
|
|
|
install:
|
1996-11-07 02:54:28 -08:00
|
|
|
if test -d $(BINDIR); then : ; else $(MKDIR) $(BINDIR); fi
|
|
|
|
if test -d $(LIBDIR); then : ; else $(MKDIR) $(LIBDIR); fi
|
|
|
|
if test -d $(MANDIR); then : ; else $(MKDIR) $(MANDIR); fi
|
1995-05-04 03:15:53 -07:00
|
|
|
cd byterun; $(MAKE) install
|
1996-04-30 07:53:58 -07:00
|
|
|
cp ocamlc $(BINDIR)/ocamlc
|
|
|
|
cp ocaml $(BINDIR)/ocaml
|
1995-05-04 03:15:53 -07:00
|
|
|
cd stdlib; $(MAKE) install
|
1996-04-30 07:53:58 -07:00
|
|
|
cp lex/ocamllex $(BINDIR)/ocamllex
|
|
|
|
cp yacc/ocamlyacc $(BINDIR)/ocamlyacc
|
1999-11-30 08:07:38 -08:00
|
|
|
cp toplevel/toplevellib.cma $(LIBDIR)/toplevellib.cma
|
1996-03-15 02:32:50 -08:00
|
|
|
cp expunge $(LIBDIR)
|
1995-08-28 04:44:00 -07:00
|
|
|
cp toplevel/topmain.cmo $(LIBDIR)
|
|
|
|
cp toplevel/toploop.cmi toplevel/topdirs.cmi $(LIBDIR)
|
1995-10-24 08:46:19 -07:00
|
|
|
cd tools; $(MAKE) install
|
1999-02-25 06:25:54 -08:00
|
|
|
cd man; $(MAKE) install
|
1998-04-27 02:56:47 -07:00
|
|
|
set -e; for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) install); done
|
1996-06-25 02:27:34 -07:00
|
|
|
if test -f ocamlopt; then $(MAKE) installopt; else :; fi
|
1997-02-23 08:29:36 -08:00
|
|
|
if test -f debugger/ocamldebug; then (cd debugger; $(MAKE) install); else :; fi
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-07-21 02:03:58 -07:00
|
|
|
# Installation of the native-code compiler
|
|
|
|
installopt:
|
|
|
|
cd asmrun; $(MAKE) install
|
1996-04-30 07:53:58 -07:00
|
|
|
cp ocamlopt $(BINDIR)/ocamlopt
|
1995-07-21 02:03:58 -07:00
|
|
|
cd stdlib; $(MAKE) installopt
|
1998-04-27 02:56:47 -07:00
|
|
|
set -e; for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) installopt); done
|
1997-11-17 02:39:01 -08:00
|
|
|
if test -f ocamlc.opt; then cp ocamlc.opt $(BINDIR)/ocamlc.opt; else :; fi
|
|
|
|
if test -f ocamlopt.opt; then cp ocamlopt.opt $(BINDIR)/ocamlopt.opt; else :; fi
|
1995-07-21 02:03:58 -07:00
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
clean:: partialclean
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
# The compiler
|
|
|
|
|
1996-04-30 07:53:58 -07:00
|
|
|
ocamlc: $(COMPOBJS)
|
|
|
|
$(CAMLC) $(LINKFLAGS) -o ocamlc $(COMPOBJS)
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1996-04-30 07:53:58 -07:00
|
|
|
rm -f ocamlc
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1995-07-02 09:40:47 -07:00
|
|
|
# The native-code compiler
|
|
|
|
|
1996-04-30 07:53:58 -07:00
|
|
|
ocamlopt: $(OPTOBJS)
|
|
|
|
$(CAMLC) $(LINKFLAGS) -o ocamlopt $(OPTOBJS)
|
1995-07-02 09:40:47 -07:00
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1996-04-30 07:53:58 -07:00
|
|
|
rm -f ocamlopt
|
1995-07-02 09:40:47 -07:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
# The toplevel
|
|
|
|
|
1996-04-30 07:53:58 -07:00
|
|
|
ocaml: $(TOPOBJS) expunge
|
|
|
|
$(CAMLC) $(LINKFLAGS) -linkall -o ocaml.tmp $(TOPOBJS)
|
|
|
|
- $(CAMLRUN) ./expunge ocaml.tmp ocaml $(PERVASIVES)
|
|
|
|
rm -f ocaml.tmp
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1999-11-30 08:07:38 -08:00
|
|
|
toplevel/toplevellib.cma: $(TOPLIB)
|
|
|
|
$(CAMLC) -a -o $@ $(TOPLIB)
|
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1999-11-30 08:07:38 -08:00
|
|
|
rm -f ocaml toplevel/toplevellib.cma
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
# The configuration file
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
utils/config.ml: utils/config.mlp config/Makefile
|
1995-07-02 09:40:47 -07:00
|
|
|
@rm -f utils/config.ml
|
1995-05-04 03:15:53 -07:00
|
|
|
sed -e 's|%%LIBDIR%%|$(LIBDIR)|' \
|
1998-04-14 07:48:34 -07:00
|
|
|
-e 's|%%BYTERUN%%|$(BINDIR)/ocamlrun|' \
|
2000-04-16 07:34:58 -07:00
|
|
|
-e 's|%%BYTECC%%|$(BYTECC) $(BYTECCCOMPOPTS)|' \
|
|
|
|
-e 's|%%BYTELINK%%|$(BYTECC) $(BYTECCLINKOPTS)|' \
|
|
|
|
-e 's|%%NATIVECC%%|$(NATIVECC) $(NATIVECCCOMPOPTS)|' \
|
|
|
|
-e 's|%%NATIVELINK%%|$(NATIVECC) $(NATIVECCLINKOPTS)|' \
|
1997-03-17 05:00:03 -08:00
|
|
|
-e 's|%%PARTIALLD%%|ld -r $(NATIVECCLINKOPTS)|' \
|
1995-05-04 03:15:53 -07:00
|
|
|
-e 's|%%CCLIBS%%|$(CCLIBS)|' \
|
1996-11-07 02:54:28 -08:00
|
|
|
-e 's|%%RANLIBCMD%%|$(RANLIBCMD)|' \
|
1995-08-08 05:17:31 -07:00
|
|
|
-e 's|%%ARCH%%|$(ARCH)|' \
|
1996-01-08 02:14:54 -08:00
|
|
|
-e 's|%%MODEL%%|$(MODEL)|' \
|
1995-08-08 05:17:31 -07:00
|
|
|
-e 's|%%SYSTEM%%|$(SYSTEM)|' \
|
1996-02-15 08:19:09 -08:00
|
|
|
-e 's|%%EXT_OBJ%%|.o|' \
|
|
|
|
-e 's|%%EXT_ASM%%|.s|' \
|
|
|
|
-e 's|%%EXT_LIB%%|.a|' \
|
1995-05-04 03:15:53 -07:00
|
|
|
utils/config.mlp > utils/config.ml
|
1995-07-02 09:40:47 -07:00
|
|
|
@chmod -w utils/config.ml
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-05-04 03:15:53 -07:00
|
|
|
rm -f utils/config.ml
|
|
|
|
|
1995-07-02 09:40:47 -07:00
|
|
|
beforedepend:: utils/config.ml
|
|
|
|
|
1997-01-01 07:38:23 -08:00
|
|
|
# The parser
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
parsing/parser.mli parsing/parser.ml: parsing/parser.mly
|
|
|
|
$(CAMLYACC) $(YACCFLAGS) parsing/parser.mly
|
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-05-04 03:15:53 -07:00
|
|
|
rm -f parsing/parser.mli parsing/parser.ml parsing/parser.output
|
|
|
|
|
|
|
|
beforedepend:: parsing/parser.mli parsing/parser.ml
|
|
|
|
|
1997-01-01 07:38:23 -08:00
|
|
|
# The lexer
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
parsing/lexer.ml: parsing/lexer.mll
|
|
|
|
$(CAMLLEX) parsing/lexer.mll
|
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-05-04 03:15:53 -07:00
|
|
|
rm -f parsing/lexer.ml
|
|
|
|
|
|
|
|
beforedepend:: parsing/lexer.ml
|
|
|
|
|
1997-02-04 07:40:22 -08:00
|
|
|
# The auxiliary lexer for counting line numbers
|
|
|
|
|
|
|
|
parsing/linenum.ml: parsing/linenum.mll
|
|
|
|
$(CAMLLEX) parsing/linenum.mll
|
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1997-02-04 07:40:22 -08:00
|
|
|
rm -f parsing/linenum.ml
|
|
|
|
|
|
|
|
beforedepend:: parsing/linenum.ml
|
|
|
|
|
1997-11-17 02:39:01 -08:00
|
|
|
# The bytecode compiler compiled with the native-code compiler
|
1995-07-12 07:22:01 -07:00
|
|
|
|
1997-11-17 02:39:01 -08:00
|
|
|
ocamlc.opt: $(COMPOBJS:.cmo=.cmx)
|
|
|
|
cd asmrun; $(MAKE) meta.o
|
|
|
|
$(CAMLOPT) $(LINKFLAGS) -o ocamlc.opt $(COMPOBJS:.cmo=.cmx) asmrun/meta.o
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f ocamlc.opt
|
1995-07-12 07:22:01 -07:00
|
|
|
|
|
|
|
# The native-code compiler compiled with itself
|
|
|
|
|
1996-04-30 07:53:58 -07:00
|
|
|
ocamlopt.opt: $(OPTOBJS:.cmo=.cmx)
|
|
|
|
$(CAMLOPT) $(LINKFLAGS) -o ocamlopt.opt $(OPTOBJS:.cmo=.cmx)
|
1995-07-12 07:22:01 -07:00
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1996-04-30 07:53:58 -07:00
|
|
|
rm -f ocamlopt.opt
|
1995-07-12 07:22:01 -07:00
|
|
|
|
1996-04-30 07:53:58 -07:00
|
|
|
$(OPTOBJS:.cmo=.cmx): ocamlopt
|
1995-11-28 06:25:05 -08:00
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
# The numeric opcodes
|
|
|
|
|
|
|
|
bytecomp/opcodes.ml: byterun/instruct.h
|
|
|
|
sed -n -e '/^enum/p' -e 's/,//g' -e '/^ /p' byterun/instruct.h | \
|
|
|
|
awk -f tools/make-opcodes > bytecomp/opcodes.ml
|
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-05-04 03:15:53 -07:00
|
|
|
rm -f bytecomp/opcodes.ml
|
|
|
|
|
|
|
|
beforedepend:: bytecomp/opcodes.ml
|
|
|
|
|
|
|
|
# The predefined exceptions and primitives
|
|
|
|
|
1996-10-09 09:20:19 -07:00
|
|
|
byterun/primitives:
|
|
|
|
cd byterun; $(MAKE) primitives
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
bytecomp/runtimedef.ml: byterun/primitives byterun/fail.h
|
|
|
|
(echo 'let builtin_exceptions = [|'; \
|
|
|
|
sed -n -e 's|.*/\* \("[A-Za-z_]*"\) \*/$$| \1;|p' byterun/fail.h | \
|
|
|
|
sed -e '$$s/;$$//'; \
|
|
|
|
echo '|]'; \
|
|
|
|
echo 'let builtin_primitives = [|'; \
|
|
|
|
sed -e 's/.*/ "&";/' -e '$$s/;$$//' byterun/primitives; \
|
|
|
|
echo '|]') > bytecomp/runtimedef.ml
|
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-05-04 03:15:53 -07:00
|
|
|
rm -f bytecomp/runtimedef.ml
|
|
|
|
|
|
|
|
beforedepend:: bytecomp/runtimedef.ml
|
|
|
|
|
1997-07-24 04:49:12 -07:00
|
|
|
# Choose the right machine-dependent files
|
1995-07-02 09:40:47 -07:00
|
|
|
|
1997-07-24 04:49:12 -07:00
|
|
|
asmcomp/arch.ml: asmcomp/$(ARCH)/arch.ml
|
|
|
|
ln -s $(ARCH)/arch.ml asmcomp/arch.ml
|
1995-07-02 09:40:47 -07:00
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-07-02 09:40:47 -07:00
|
|
|
rm -f asmcomp/arch.ml
|
|
|
|
|
|
|
|
beforedepend:: asmcomp/arch.ml
|
|
|
|
|
1997-07-24 04:49:12 -07:00
|
|
|
asmcomp/proc.ml: asmcomp/$(ARCH)/proc.ml
|
|
|
|
ln -s $(ARCH)/proc.ml asmcomp/proc.ml
|
1995-07-02 09:40:47 -07:00
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-07-02 09:40:47 -07:00
|
|
|
rm -f asmcomp/proc.ml
|
|
|
|
|
|
|
|
beforedepend:: asmcomp/proc.ml
|
|
|
|
|
1997-07-24 04:49:12 -07:00
|
|
|
asmcomp/selection.ml: asmcomp/$(ARCH)/selection.ml
|
|
|
|
ln -s $(ARCH)/selection.ml asmcomp/selection.ml
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f asmcomp/selection.ml
|
|
|
|
|
|
|
|
beforedepend:: asmcomp/selection.ml
|
|
|
|
|
|
|
|
asmcomp/reload.ml: asmcomp/$(ARCH)/reload.ml
|
|
|
|
ln -s $(ARCH)/reload.ml asmcomp/reload.ml
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f asmcomp/reload.ml
|
|
|
|
|
|
|
|
beforedepend:: asmcomp/reload.ml
|
|
|
|
|
|
|
|
asmcomp/scheduling.ml: asmcomp/$(ARCH)/scheduling.ml
|
|
|
|
ln -s $(ARCH)/scheduling.ml asmcomp/scheduling.ml
|
|
|
|
|
|
|
|
partialclean::
|
|
|
|
rm -f asmcomp/scheduling.ml
|
|
|
|
|
|
|
|
beforedepend:: asmcomp/scheduling.ml
|
|
|
|
|
1995-07-02 09:40:47 -07:00
|
|
|
# Preprocess the code emitters
|
|
|
|
|
1997-07-24 04:49:12 -07:00
|
|
|
asmcomp/emit.ml: asmcomp/$(ARCH)/emit.mlp tools/cvt_emit
|
|
|
|
boot/ocamlrun tools/cvt_emit < asmcomp/$(ARCH)/emit.mlp > asmcomp/emit.ml \
|
1995-08-10 05:50:19 -07:00
|
|
|
|| { rm -f asmcomp/emit.ml; exit 2; }
|
1995-07-02 09:40:47 -07:00
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-07-02 09:40:47 -07:00
|
|
|
rm -f asmcomp/emit.ml
|
|
|
|
|
|
|
|
beforedepend:: asmcomp/emit.ml
|
|
|
|
|
1996-10-07 06:19:16 -07:00
|
|
|
tools/cvt_emit: tools/cvt_emit.mll
|
|
|
|
cd tools; $(MAKE) cvt_emit
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
# The "expunge" utility
|
|
|
|
|
|
|
|
expunge: $(EXPUNGEOBJS)
|
|
|
|
$(CAMLC) $(LINKFLAGS) -o expunge $(EXPUNGEOBJS)
|
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-05-04 03:15:53 -07:00
|
|
|
rm -f expunge
|
|
|
|
|
1995-07-21 02:03:58 -07:00
|
|
|
# The runtime system for the bytecode compiler
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
runtime:
|
|
|
|
cd byterun; $(MAKE) all
|
1997-01-05 06:06:13 -08:00
|
|
|
if test -f stdlib/libcamlrun.a; then :; else \
|
|
|
|
ln -s ../byterun/libcamlrun.a stdlib/libcamlrun.a; fi
|
1997-02-16 05:36:42 -08:00
|
|
|
clean::
|
1995-05-04 03:15:53 -07:00
|
|
|
cd byterun; $(MAKE) clean
|
1997-01-05 06:06:13 -08:00
|
|
|
rm -f stdlib/libcamlrun.a
|
1995-05-04 03:15:53 -07:00
|
|
|
alldepend::
|
|
|
|
cd byterun; $(MAKE) depend
|
|
|
|
|
1995-07-21 02:03:58 -07:00
|
|
|
# The runtime system for the native-code compiler
|
|
|
|
|
|
|
|
runtimeopt:
|
|
|
|
cd asmrun; $(MAKE) all
|
1995-07-28 06:58:50 -07:00
|
|
|
if test -f stdlib/libasmrun.a; then :; else \
|
1995-07-30 07:24:06 -07:00
|
|
|
ln -s ../asmrun/libasmrun.a stdlib/libasmrun.a; fi
|
1997-02-16 05:36:42 -08:00
|
|
|
clean::
|
1995-07-21 02:03:58 -07:00
|
|
|
cd asmrun; $(MAKE) clean
|
1997-01-05 06:06:13 -08:00
|
|
|
rm -f stdlib/libasmrun.a
|
1995-07-21 02:03:58 -07:00
|
|
|
alldepend::
|
|
|
|
cd asmrun; $(MAKE) depend
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
# The library
|
|
|
|
|
1998-06-24 12:22:26 -07:00
|
|
|
library: ocamlc
|
1995-05-04 03:15:53 -07:00
|
|
|
cd stdlib; $(MAKE) all
|
1995-06-18 07:43:13 -07:00
|
|
|
library-cross:
|
1996-04-30 07:53:58 -07:00
|
|
|
cd stdlib; $(MAKE) RUNTIME=../byterun/ocamlrun all
|
1995-07-21 02:03:58 -07:00
|
|
|
libraryopt:
|
|
|
|
cd stdlib; $(MAKE) allopt
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-05-04 03:15:53 -07:00
|
|
|
cd stdlib; $(MAKE) clean
|
|
|
|
alldepend::
|
|
|
|
cd stdlib; $(MAKE) depend
|
|
|
|
|
|
|
|
# The lexer and parser generators
|
|
|
|
|
1998-06-24 12:22:26 -07:00
|
|
|
ocamllex: ocamlyacc ocamlc
|
1995-08-28 04:44:00 -07:00
|
|
|
cd lex; $(MAKE) all
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-05-04 03:15:53 -07:00
|
|
|
cd lex; $(MAKE) clean
|
|
|
|
alldepend::
|
|
|
|
cd lex; $(MAKE) depend
|
|
|
|
|
1996-04-30 07:53:58 -07:00
|
|
|
ocamlyacc:
|
1995-08-28 04:44:00 -07:00
|
|
|
cd yacc; $(MAKE) all
|
1997-02-16 05:36:42 -08:00
|
|
|
clean::
|
1995-05-04 03:15:53 -07:00
|
|
|
cd yacc; $(MAKE) clean
|
|
|
|
|
1995-08-28 04:44:00 -07:00
|
|
|
# Tools
|
1995-05-04 03:15:53 -07:00
|
|
|
|
1998-06-24 12:22:26 -07:00
|
|
|
ocamltools: ocamlc ocamlyacc ocamllex
|
1995-08-28 04:44:00 -07:00
|
|
|
cd tools; $(MAKE) all
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-05-04 03:15:53 -07:00
|
|
|
cd tools; $(MAKE) clean
|
|
|
|
alldepend::
|
|
|
|
cd tools; $(MAKE) depend
|
|
|
|
|
1995-11-06 03:04:07 -08:00
|
|
|
# The extra libraries
|
|
|
|
|
|
|
|
otherlibraries:
|
|
|
|
set -e; for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) all); done
|
|
|
|
otherlibrariesopt:
|
|
|
|
set -e; for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) allopt); done
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
|
|
|
for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) partialclean); done
|
1995-11-06 03:04:07 -08:00
|
|
|
clean::
|
|
|
|
for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) clean); done
|
|
|
|
alldepend::
|
|
|
|
for i in $(OTHERLIBRARIES); do (cd otherlibs/$$i; $(MAKE) depend); done
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
# The replay debugger
|
|
|
|
|
1998-06-24 12:22:26 -07:00
|
|
|
ocamldebugger: ocamlc ocamlyacc ocamllex
|
1997-02-23 08:29:36 -08:00
|
|
|
cd debugger; $(MAKE) all
|
|
|
|
partialclean::
|
|
|
|
cd debugger; $(MAKE) clean
|
|
|
|
alldepend::
|
|
|
|
cd debugger; $(MAKE) depend
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
# Default rules
|
|
|
|
|
1995-07-12 07:22:01 -07:00
|
|
|
.SUFFIXES: .ml .mli .cmo .cmi .cmx
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
.ml.cmo:
|
|
|
|
$(CAMLC) $(COMPFLAGS) -c $<
|
|
|
|
|
|
|
|
.mli.cmi:
|
|
|
|
$(CAMLC) $(COMPFLAGS) -c $<
|
|
|
|
|
1995-07-12 07:22:01 -07:00
|
|
|
.ml.cmx:
|
|
|
|
$(CAMLOPT) $(COMPFLAGS) -c $<
|
|
|
|
|
1997-02-16 05:36:42 -08:00
|
|
|
partialclean::
|
1995-07-12 08:30:16 -07:00
|
|
|
rm -f utils/*.cm[iox] utils/*.[so] utils/*~
|
|
|
|
rm -f parsing/*.cm[iox] parsing/*.[so] parsing/*~
|
|
|
|
rm -f typing/*.cm[iox] typing/*.[so] typing/*~
|
|
|
|
rm -f bytecomp/*.cm[iox] bytecomp/*.[so] bytecomp/*~
|
|
|
|
rm -f asmcomp/*.cm[iox] asmcomp/*.[so] asmcomp/*~
|
|
|
|
rm -f driver/*.cm[iox] driver/*.[so] driver/*~
|
|
|
|
rm -f toplevel/*.cm[iox] toplevel/*.[so] toplevel/*~
|
1995-08-25 06:53:40 -07:00
|
|
|
rm -f tools/*.cm[iox] tools/*.[so] tools/*~
|
1995-05-04 03:15:53 -07:00
|
|
|
rm -f *~
|
|
|
|
|
|
|
|
depend: beforedepend
|
1995-08-25 06:53:40 -07:00
|
|
|
(for d in utils parsing typing bytecomp asmcomp driver toplevel; \
|
|
|
|
do $(CAMLDEP) $(DEPFLAGS) $$d/*.mli $$d/*.ml; \
|
|
|
|
done) > .depend
|
1995-05-04 03:15:53 -07:00
|
|
|
|
|
|
|
alldepend:: depend
|
|
|
|
|
|
|
|
include .depend
|