summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>2012-04-18 08:50:26 +0000
committerFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>2012-04-18 08:50:26 +0000
commit905143bfa21672fef20e55ebe7a8233cd26881c5 (patch)
tree13eea7a06c6dcea2416011ad873e337380c19acf /Makefile
parent3930c2fd79e43bd02e3bc79d6b047f3aeab0effe (diff)
downloadocaml-905143bfa21672fef20e55ebe7a8233cd26881c5.tar.gz
Add hooks in Asmgen
Add hooks in Asmgen to allow external developers to add new passes on the typedtree, lambda, clambda and cmm trees. A library 'ocamlopt.cm{a/xa}' is installed, with optmain.cm{x/o}, so that developers can create new ocamlopt executables containing these new passes. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12370 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 21 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index d7ec3b76cc..01e2bb67e7 100644
--- a/Makefile
+++ b/Makefile
@@ -89,8 +89,10 @@ ASMCOMP=asmcomp/arch.cmo asmcomp/debuginfo.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
+OPTEND= driver/pparse.cmo driver/opterrors.cmo driver/optcompile.cmo \
+ driver/main_args.cmo
+OPTMAIN= driver/optmain.cmo
+OPTDRIVER= $(OPTEND) $(OPTMAIN)
TOPLEVEL=driver/pparse.cmo driver/errors.cmo driver/compile.cmo \
driver/main_args.cmo toplevel/genprintval.cmo toplevel/toploop.cmo \
@@ -105,9 +107,8 @@ TOPLIB=$(UTILS) $(PARSING) $(TYPING) $(COMP) $(BYTECOMP) $(TOPLEVEL)
TOPOBJS=$(TOPLEVELLIB) $(TOPLEVELSTART)
-NATTOPOBJS=$(OPTUTILS) $(PARSING) $(TYPING) $(COMP) $(ASMCOMP) \
- driver/pparse.cmo driver/opterrors.cmo driver/optcompile.cmo \
- driver/main_args.cmo \
+OPTFILES=$(OPTUTILS) $(PARSING) $(TYPING) $(COMP) $(ASMCOMP) $(OPTEND)
+NATTOPOBJS= $(OPTFILES) \
toplevel/genprintval.cmo toplevel/opttoploop.cmo toplevel/opttopdirs.cmo \
toplevel/opttopmain.cmo toplevel/opttopstart.cmo
@@ -315,6 +316,7 @@ install:
installopt:
cd asmrun; $(MAKE) install
cp ocamlopt $(BINDIR)/ocamlopt$(EXE)
+ cp driver/ocamlopt.cma driver/optmain.cmo $(LIBDIR)/
cd stdlib; $(MAKE) installopt
cd ocamldoc; $(MAKE) installopt
for i in $(OTHERLIBRARIES); \
@@ -322,7 +324,11 @@ installopt:
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
+ then \
+ cp ocamlopt.opt $(BINDIR)/ocamlopt.opt$(EXE); \
+ cp driver/ocamlopt.$(A) driver/ocamlopt.cmxa \
+ driver/optmain.cmx driver/optmain.$(O) $(LIBDIR)/; \
+ else :; fi
if test -f lex/ocamllex.opt; \
then cp lex/ocamllex.opt $(BINDIR)/ocamllex.opt$(EXE); else :; fi
@@ -340,15 +346,17 @@ partialclean::
rm -f ocamlc ocamlcomp.sh
# The native-code compiler
+driver/ocamlopt.cma: $(OPTOBJS)
+ $(CAMLC) $(LINKFLAGS) -a -o driver/ocamlopt.cma $(OPTFILES)
-ocamlopt: $(OPTOBJS)
+ocamlopt: $(OPTOBJS) driver/ocamlopt.cma
$(CAMLC) $(LINKFLAGS) -o ocamlopt $(OPTOBJS)
@sed -e 's|@compiler@|$$topdir/boot/ocamlrun $$topdir/ocamlopt|' \
driver/ocamlcomp.sh.in > ocamlcompopt.sh
@chmod +x ocamlcompopt.sh
partialclean::
- rm -f ocamlopt ocamlcompopt.sh
+ rm -f ocamlopt ocamlcompopt.sh driver/ocamlopt.cma
# The toplevel
@@ -446,14 +454,17 @@ partialclean::
# The native-code compiler compiled with itself
-ocamlopt.opt: $(OPTOBJS:.cmo=.cmx)
+driver/ocamlopt.cmxa: $(OPTOBJS:.cmo=.cmx)
+ $(CAMLOPT) $(LINKFLAGS) -a -o driver/ocamlopt.cmxa $(OPTFILES:.cmo=.cmx)
+
+ocamlopt.opt: driver/ocamlopt.cmxa $(OPTOBJS:.cmo=.cmx)
$(CAMLOPT) $(LINKFLAGS) -o ocamlopt.opt $(OPTOBJS:.cmo=.cmx)
@sed -e 's|@compiler@|$$topdir/ocamlopt.opt|' \
driver/ocamlcomp.sh.in > ocamlcompopt.sh
@chmod +x ocamlcompopt.sh
partialclean::
- rm -f ocamlopt.opt
+ rm -f ocamlopt.opt driver/ocamlopt.cmxa driver/ocamlopt.$(A)
$(OPTOBJS:.cmo=.cmx): ocamlopt