summaryrefslogtreecommitdiffstats
path: root/Makefile.nt
diff options
context:
space:
mode:
authorFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>2012-05-29 10:48:19 +0000
committerFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>2012-05-29 10:48:19 +0000
commit87f6cd4779008d5ac6f4ac2365a540da0344de14 (patch)
tree9306e992ff42323bf40adacd0f0e74815b68c5ed /Makefile.nt
parent8889c93af2332d9da47af6ad3cd6d97ab6fb2627 (diff)
modified Windows Makefiles to install compiler internals
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12496 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'Makefile.nt')
-rw-r--r--Makefile.nt156
1 files changed, 93 insertions, 63 deletions
diff --git a/Makefile.nt b/Makefile.nt
index 0b9e4e7c2..91ac026e0 100644
--- a/Makefile.nt
+++ b/Makefile.nt
@@ -38,8 +38,6 @@ UTILS=utils/misc.cmo utils/tbl.cmo utils/config.cmo \
utils/clflags.cmo utils/terminfo.cmo utils/ccomp.cmo utils/warnings.cmo \
utils/consistbl.cmo
-OPTUTILS=$(UTILS)
-
PARSING=parsing/location.cmo parsing/longident.cmo \
parsing/syntaxerr.cmo parsing/parser.cmo \
parsing/lexer.cmo parsing/parse.cmo parsing/printast.cmo
@@ -61,12 +59,16 @@ COMP=bytecomp/lambda.cmo bytecomp/printlambda.cmo \
bytecomp/typeopt.cmo bytecomp/switch.cmo bytecomp/matching.cmo \
bytecomp/translobj.cmo bytecomp/translcore.cmo \
bytecomp/translclass.cmo bytecomp/translmod.cmo \
- bytecomp/simplif.cmo bytecomp/runtimedef.cmo
+ bytecomp/simplif.cmo bytecomp/runtimedef.cmo \
+ driver/pparse.cmo driver/main_args.cmo
+
+COMMON=$(UTILS) $(PARSING) $(TYPING) $(COMP)
BYTECOMP=bytecomp/meta.cmo bytecomp/instruct.cmo bytecomp/bytegen.cmo \
bytecomp/printinstr.cmo bytecomp/opcodes.cmo bytecomp/emitcode.cmo \
bytecomp/bytesections.cmo bytecomp/dll.cmo bytecomp/symtable.cmo \
- bytecomp/bytelink.cmo bytecomp/bytelibrarian.cmo bytecomp/bytepackager.cmo
+ bytecomp/bytelink.cmo bytecomp/bytelibrarian.cmo bytecomp/bytepackager.cmo \
+ driver/errors.cmo driver/compile.cmo
ASMCOMP=asmcomp/arch.cmo asmcomp/debuginfo.cmo \
asmcomp/cmm.cmo asmcomp/printcmm.cmo \
@@ -81,41 +83,17 @@ ASMCOMP=asmcomp/arch.cmo asmcomp/debuginfo.cmo \
asmcomp/printlinear.cmo asmcomp/linearize.cmo \
asmcomp/schedgen.cmo asmcomp/scheduling.cmo \
asmcomp/emitaux.cmo asmcomp/emit.cmo asmcomp/asmgen.cmo \
- asmcomp/asmlink.cmo asmcomp/asmlibrarian.cmo asmcomp/asmpackager.cmo
-
-DRIVER=driver/pparse.cmo driver/errors.cmo driver/compile.cmo \
- driver/main_args.cmo driver/main.cmo
-
-OPTDRIVER=driver/pparse.cmo driver/opterrors.cmo driver/optcompile.cmo \
- driver/main_args.cmo driver/optmain.cmo
+ asmcomp/asmlink.cmo asmcomp/asmlibrarian.cmo asmcomp/asmpackager.cmo \
+ driver/opterrors.cmo driver/optcompile.cmo
-TOPLEVEL=driver/pparse.cmo driver/errors.cmo driver/compile.cmo \
- driver/main_args.cmo toplevel/genprintval.cmo toplevel/toploop.cmo \
+TOPLEVEL=toplevel/genprintval.cmo toplevel/toploop.cmo \
toplevel/trace.cmo toplevel/topdirs.cmo toplevel/topmain.cmo
-TOPLEVELLIB=toplevel/toplevellib.cma
-TOPLEVELSTART=toplevel/topstart.cmo
-
-COMPOBJS=$(UTILS) $(PARSING) $(TYPING) $(COMP) $(BYTECOMP) $(DRIVER)
-
-TOPLIB=$(UTILS) $(PARSING) $(TYPING) $(COMP) $(BYTECOMP) $(TOPLEVEL)
-
-TOPOBJS=$(TOPLEVELLIB) $(TOPLEVELSTART)
+BYTESTART=driver/main.cmo
-NATTOPOBJS=$(OPTUTILS) $(PARSING) $(TYPING) $(COMP) $(ASMCOMP) \
- driver/pparse.cmo driver/opterrors.cmo driver/optcompile.cmo \
- driver/main_args.cmo \
- toplevel/genprintval.cmo toplevel/opttoploop.cmo toplevel/opttopdirs.cmo \
- toplevel/opttopmain.cmo toplevel/opttopstart.cmo
+OPTSTART=driver/optmain.cmo
-OPTOBJS=$(OPTUTILS) $(PARSING) $(TYPING) $(COMP) $(ASMCOMP) $(OPTDRIVER)
-
-EXPUNGEOBJS=utils/misc.cmo utils/tbl.cmo \
- utils/config.cmo utils/clflags.cmo \
- typing/ident.cmo typing/path.cmo typing/types.cmo typing/btype.cmo \
- utils/warnings.cmo parsing/location.cmo \
- typing/predef.cmo bytecomp/runtimedef.cmo bytecomp/bytesections.cmo \
- bytecomp/dll.cmo bytecomp/meta.cmo bytecomp/symtable.cmo toplevel/expunge.cmo
+TOPLEVELSTART=toplevel/topstart.cmo
PERVASIVES=$(STDLIB_MODULES) topdirs toploop outcometree
@@ -221,22 +199,24 @@ opt.opt: core opt-core ocamlc.opt all ocamlopt.opt ocamllex.opt \
world.opt: coldstart opt.opt
# Installation
+
+COMPLIBDIR=$(LIBDIR)/compiler-libs
+
install: installbyt installopt
installbyt:
mkdir -p $(BINDIR)
mkdir -p $(LIBDIR)
+ mkdir -p $(COMPLIBDIR)
cd byterun ; $(MAKEREC) install
cp ocamlc $(BINDIR)/ocamlc.exe
cp ocaml $(BINDIR)/ocaml.exe
cd stdlib ; $(MAKEREC) install
cp lex/ocamllex $(BINDIR)/ocamllex.exe
cp yacc/ocamlyacc.exe $(BINDIR)/ocamlyacc.exe
- cp toplevel/toplevellib.cma $(LIBDIR)/toplevellib.cma
+ cp utils/*.cmi parsing/*.cmi typing/*.cmi bytecomp/*.cmi driver/*.cmi toplevel/*.cmi $(COMPLIBDIR)
+ cp compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma compilerlibs/ocamltoplevel.cma $(BYTESTART) $(TOPLEVELSTART) $(COMPLIBDIR)
cp expunge $(LIBDIR)/expunge.exe
- cp typing/outcometree.cmi typing/outcometree.mli $(LIBDIR)
- cp toplevel/topstart.cmo $(LIBDIR)
- cp toplevel/toploop.cmi toplevel/topdirs.cmi toplevel/topmain.cmi $(LIBDIR)
cd tools ; $(MAKEREC) install
cd ocamldoc ; $(MAKEREC) install
mkdir -p $(STUBLIBDIR)
@@ -255,49 +235,78 @@ installopt:
cd asmrun ; $(MAKEREC) install
cp ocamlopt $(BINDIR)/ocamlopt.exe
cd stdlib ; $(MAKEREC) installopt
+ cp asmcomp/*.cmi driver/*.cmi $(COMPLIBDIR)
+ cp compilerlibs/ocamloptcomp.cma $(OPTSTART) $(COMPLIBDIR)
cd ocamldoc ; $(MAKEREC) installopt
for i in $(OTHERLIBRARIES); do $(MAKEREC) -C otherlibs/$$i installopt; done
- if test -f ocamlc.opt; \
- then cp ocamlc.opt $(BINDIR)/ocamlc.opt.exe; else :; fi
- if test -f ocamlopt.opt; \
- then cp ocamlopt.opt $(BINDIR)/ocamlopt.opt.exe; else :; fi
- if test -f lex/ocamllex.opt; \
- then cp lex/ocamllex.opt $(BINDIR)/ocamllex.opt.exe; else :; fi
+ if test -f ocamlopt.opt ; then $(MAKEREC) installoptopt; fi
+
+installoptopt:
+ cp ocamlc.opt $(BINDIR)/ocamlc.opt$(EXE)
+ cp ocamlopt.opt $(BINDIR)/ocamlopt.opt$(EXE)
+ cp lex/ocamllex.opt $(BINDIR)/ocamllex.opt$(EXE)
+ cp compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlcommon.a \
+ compilerlibs/ocamlbytecomp.cmxa compilerlibs/ocamlbytecomp.a \
+ compilerlibs/ocamloptcomp.cmxa compilerlibs/ocamloptcomp.a \
+ $(COMPLIBDIR)
clean:: partialclean
# The compiler
-ocamlc: $(COMPOBJS)
- $(CAMLC) $(LINKFLAGS) -o ocamlc $(COMPOBJS)
+compilerlibs/ocamlcommon.cma: $(COMMON)
+ $(CAMLC) -a -o $@ $(COMMON)
+partialclean::
+ rm -f compilerlibs/ocamlcommon.cma
+
+# The bytecode compiler
+
+compilerlibs/ocamlbytecomp.cma: $(BYTECOMP)
+ $(CAMLC) -a -o $@ $(BYTECOMP)
+partialclean::
+ rm -f compilerlibs/ocamlbytecomp.cma
+
+ocamlc: compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma $(BYTESTART)
+ $(CAMLC) $(LINKFLAGS) -o ocamlc \
+ compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma $(BYTESTART)
@sed -e 's|@compiler@|$$topdir/boot/ocamlrun $$topdir/ocamlc|' \
driver/ocamlcomp.sh.in > ocamlcomp.sh
@chmod +x ocamlcomp.sh
partialclean::
- rm -f ocamlc
+ rm -f ocamlc ocamlcomp.sh
# The native-code compiler
-ocamlopt: $(OPTOBJS)
- $(CAMLC) $(LINKFLAGS) -o ocamlopt $(OPTOBJS)
+compilerlibs/ocamloptcomp.cma: $(ASMCOMP)
+ $(CAMLC) -a -o $@ $(ASMCOMP)
+partialclean::
+ rm -f compilerlibs/ocamloptcomp.cma
+
+ocamlopt: compilerlibs/ocamlcommon.cma compilerlibs/ocamloptcomp.cma $(OPTSTART)
+ $(CAMLC) $(LINKFLAGS) -o ocamlopt \
+ compilerlibs/ocamlcommon.cma compilerlibs/ocamloptcomp.cma $(OPTSTART)
@sed -e 's|@compiler@|$$topdir/boot/ocamlrun $$topdir/ocamlopt|' \
driver/ocamlcomp.sh.in > ocamlcompopt.sh
@chmod +x ocamlcompopt.sh
partialclean::
- rm -f ocamlopt
+ rm -f ocamlopt ocamlcompopt.sh
# The toplevel
-ocaml: $(TOPOBJS) expunge
- $(CAMLC) $(LINKFLAGS) -linkall -o ocaml.tmp $(TOPOBJS)
+compilerlibs/ocamltoplevel.cma: $(TOPLEVEL)
+ $(CAMLC) -a -o $@ $(TOPLEVEL)
+partialclean::
+ rm -f compilerlibs/ocamltoplevel.cma
+
+ocaml: compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma compilerlibs/ocamltoplevel.cma $(TOPLEVELSTART) expunge
+ $(CAMLC) $(LINKFLAGS) -linkall -o ocaml.tmp \
+ compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma \
+ compilerlibs/ocamltoplevel.cma $(TOPLEVELSTART)
- $(CAMLRUN) ./expunge ocaml.tmp ocaml $(PERVASIVES)
rm -f ocaml.tmp
-toplevel/toplevellib.cma: $(TOPLIB)
- $(CAMLC) -a -o $@ $(TOPLIB)
-
partialclean::
rm -f ocaml
@@ -371,11 +380,24 @@ partialclean::
beforedepend:: parsing/lexer.ml
+# Shared parts of the system compiled with the native-code compiler
+
+compilerlibs/ocamlcommon.cmxa: $(COMMON:.cmo=.cmx)
+ $(CAMLOPT) -a -o $@ $(COMMON:.cmo=.cmx)
+partialclean::
+ rm -f compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlcommon.a
+
# The bytecode compiler compiled with the native-code compiler
-ocamlc.opt: $(COMPOBJS:.cmo=.cmx)
- cd asmrun ; $(MAKEREC) meta.$(O) dynlink.$(O)
- $(CAMLOPT) $(LINKFLAGS) -o ocamlc.opt $(COMPOBJS:.cmo=.cmx) asmrun/meta.$(O) asmrun/dynlink.$(O)
+compilerlibs/ocamlbytecomp.cmxa: $(BYTECOMP:.cmo=.cmx)
+ $(CAMLOPT) -a -o $@ $(BYTECOMP:.cmo=.cmx)
+partialclean::
+ rm -f compilerlibs/ocamlbytecomp.cmxa compilerlibs/ocamlbytecomp.a
+
+ocamlc.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa $(BYTESTART:.cmo=.cmx)
+ $(CAMLOPT) $(LINKFLAGS) -ccopt "$(BYTECCLINKOPTS)" -o ocamlc.opt \
+ compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \
+ $(BYTESTART:.cmo=.cmx) -cclib "$(BYTECCLIBS)"
@sed -e 's|@compiler@|$$topdir/ocamlc.opt|' \
driver/ocamlcomp.sh.in > ocamlcomp.sh
@chmod +x ocamlcomp.sh
@@ -385,8 +407,15 @@ partialclean::
# The native-code compiler compiled with itself
-ocamlopt.opt: $(OPTOBJS:.cmo=.cmx)
- $(CAMLOPT) $(LINKFLAGS) -o ocamlopt.opt $(OPTOBJS:.cmo=.cmx)
+compilerlibs/ocamloptcomp.cmxa: $(ASMCOMP:.cmo=.cmx)
+ $(CAMLOPT) -a -o $@ $(ASMCOMP:.cmo=.cmx)
+partialclean::
+ rm -f compilerlibs/ocamloptcomp.cmxa compilerlibs/ocamloptcomp.a
+
+ocamlopt.opt: compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa $(OPTSTART:.cmo=.cmx)
+ $(CAMLOPT) $(LINKFLAGS) -o ocamlopt.opt \
+ compilerlibs/ocamlcommon.cmxa compilerlibs/ocamloptcomp.cmxa \
+ $(OPTSTART:.cmo=.cmx)
@sed -e 's|@compiler@|$$topdir/ocamlopt.opt|' \
driver/ocamlcomp.sh.in > ocamlcompopt.sh
@chmod +x ocamlcompopt.sh
@@ -394,7 +423,7 @@ ocamlopt.opt: $(OPTOBJS:.cmo=.cmx)
partialclean::
rm -f ocamlopt.opt
-$(OPTOBJS:.cmo=.cmx): ocamlopt
+$(COMMON:.cmo=.cmx) $(BYTECOMP:.cmo=.cmx) $(ASMCOMP:.cmo=.cmx): ocamlopt
# The numeric opcodes
@@ -489,8 +518,9 @@ tools/cvt_emit: tools/cvt_emit.mll
# The "expunge" utility
-expunge: $(EXPUNGEOBJS)
- $(CAMLC) $(LINKFLAGS) -o expunge $(EXPUNGEOBJS)
+expunge: compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma toplevel/expunge.cmo
+ $(CAMLC) $(LINKFLAGS) -o expunge \
+ compilerlibs/ocamlcommon.cma compilerlibs/ocamlbytecomp.cma toplevel/expunge.cmo
partialclean::
rm -f expunge