Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed the build system to be able to compile the compiler, the runt…

…ime and the standard library without copying the the latter two to a new directory
  • Loading branch information...
commit 749463ab58ab1bc665c3933d5073fe7bea42c330 1 parent 77996ab
@colinbenner authored
View
46 Makefile
@@ -1,3 +1,10 @@
+# Enable parallel build by default.
+BUILDFLAGS=-j 5
+LIBDIR=/home/joghurt/ocaml-bin/lib/ocaml
+RANLIB=ranlib
+OCAMLC=ocamlc
+OCAMLOPT=ocamlllvm
+
# OASIS_START
# DO NOT EDIT (digest: bc1e05bfc8b39b664f29dae8dbd3ebbb)
@@ -36,3 +43,42 @@ setup.data:
.PHONY: build doc test all install uninstall reinstall clean distclean configure
# OASIS_STOP
+
+asmrun src/asmrun/libasmrun.a:
+ cd src/asmrun; make -j 5
+
+asmrun-install: src/asmrun/libasmrun.a
+ cd src/asmrun; make install
+
+asmrun-clean:
+ cd src/asmrun; make clean
+
+
+.PHONY: stdlib install-stdlib stdlib-clean
+stdlib: src/stdlib/_build/std_exit.o src/stdlib/_build/stdlib.a src/stdlib/_build/stdlib.cmxa
+ @touch /dev/null
+
+src/stdlib/_build/std_exit.o src/stdlib/_build/stdlib.a src/stdlib/_build/stdlib.cmxa:
+ cd src/stdlib; ocamlbuild
+ cd src/stdlib; OCAMLLIB=$(LIBDIR) ocamlbuild $(BUILDFLAGS) -ocamlopt $(OCAMLOPT) stdlib.otarget
+
+
+stdlib-install: src/stdlib/_build/std_exit.o src/stdlib/_build/stdlib.a src/stdlib/_build/stdlib.cmxa
+ cd src/stdlib/_build; cp std_exit.o stdlib.a stdlib.cmxa *.cmi $(LIBDIR)
+ cd $(LIBDIR); $(RANLIB) stdlib.a; \
+ ln -fs stdlib.cmxa stdlib.p.cmxa; \
+ ln -fs stdlib.a stdlib.p.a; \
+ ln -fs std_exit.cmx std_exit.p.cmx; \
+ ln -fs std_exit.o std_exit.p.o
+
+stdlib-clean:
+ cd src/stdlib; ocamlbuild -clean
+
+compile-and-install-everything:
+ make
+ sudo make install
+ make asmrun
+ make asmrun-install
+ make stdlib-clean
+ make stdlib
+ make stdlib-install
View
10 _tags
@@ -1,7 +1,15 @@
+# stdlib is build independently using ocamlbuild
+"src/stdlib": -traverse
+
+# asmrun is built using make
+"src/asmrun": -traverse
+
<src/{asmcomp,bytecomp,driver,parsing,toplevel,typing,utils}>: include
-<src/*/*.ml{,i}>: pkg_dynlink, pkg_findlib
#<src/*/*.mlp>: process_mlp
+<**/*.ml*>: warn_error_A
+
+
# OASIS_START
# DO NOT EDIT (digest: 07d21b1350eb56096d1bbcc0507aa988)
# Ignore VCS directories, you can use the same kind of rule outside
View
20 myocamlbuild.ml
@@ -527,13 +527,31 @@ List.iter
(* Generate architecture specific emit file from emit.mlp *)
let emit_mlp = "src/asmcomp"/arch/"emit.mlp" in
rule "emit.mlp"
- ~prod:("src/asmcomp/emit.ml")
+ ~prod:"src/asmcomp/emit.ml"
~deps:[emit_mlp; "tools/cvt_emit"]
begin fun _ _ ->
Cmd(S[A"ocamlrun"; P"tools/cvt_emit"; Sh "<"; P emit_mlp;
Sh">"; Px"src/asmcomp/emit.ml"])
end;;
+(* The version number *)
+rule "src/stdlib/sys.ml"
+ ~prod:"src/stdlib/sys.ml"
+ ~dep:"src/stdlib/sys.mlp"
+ begin fun _ _ ->
+ let version = BaseEnvLight.var_get "ocaml_version" env in
+ Seq [rm_f "src/stdlib/sys.ml";
+ Cmd (S[A"sed"; A"-e";
+ A(Printf.sprintf "s,%%%%VERSION%%%%,%s," version);
+ Sh"<"; P"src/stdlib/sys.mlp"; Sh">"; Px"src/stdlib/sys.ml"]);
+ chmod (A"-w") "src/stdlib/sys.ml"]
+ end;;
+
+(* We are building the standard library so we do not need the old one *)
+flag ["ocaml"; "compile"; "nostdlib"] (A"-nostdlib");;
+
+dep ["ocaml"; "foobar"] ["src/stdlib/pervasives.cmi"];;
+
end in ()
| _ ->
()
View
27 src/stdlib/Compflags
@@ -1,27 +0,0 @@
-#!/bin/sh
-#########################################################################
-# #
-# Objective Caml #
-# #
-# Xavier Leroy, projet Cristal, INRIA Rocquencourt #
-# #
-# Copyright 2004 Institut National de Recherche en Informatique et #
-# en Automatique. All rights reserved. This file is distributed #
-# under the terms of the GNU Library General Public License, with #
-# the special exception on linking described in file ../LICENSE. #
-# #
-#########################################################################
-
-# $Id$
-
-case $1 in
- pervasives.cm[iox]|pervasives.p.cmx) echo ' -nopervasives';;
- camlinternalOO.cmi) echo ' -nopervasives';;
- camlinternalOO.cmx|camlinternalOO.p.cmx) echo ' -inline 0';;
- scanf.cmx|scanf.p.cmx) echo ' -inline 9';;
- arrayLabels.cm[ox]|arrayLabels.p.cmx) echo ' -nolabels';;
- listLabels.cm[ox]|listLabels.p.cmx) echo ' -nolabels';;
- stringLabels.cm[ox]|stringLabels.p.cmx) echo ' -nolabels';;
- moreLabels.cm[ox]|moreLabels.p.cmx) echo ' -nolabels';;
- *) echo ' ';;
-esac
View
62 src/stdlib/Makefile
@@ -1,62 +0,0 @@
-#########################################################################
-# #
-# 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 GNU Library General Public License, with #
-# the special exception on linking described in file ../LICENSE. #
-# #
-#########################################################################
-
-# $Id$
-
-include Makefile.shared
-
-allopt: stdlib.cmxa std_exit.cmx allopt-$(PROFILING)
-
-allopt-noprof:
-
-allopt-prof: stdlib.p.cmxa std_exit.p.cmx
- rm -f std_exit.p.cmi
-
-installopt: installopt-default installopt-$(PROFILING)
-
-installopt-default:
- cp stdlib.cmxa stdlib.a std_exit.o *.cmx $(LIBDIR)
- cd $(LIBDIR); $(RANLIB) stdlib.a
-
-installopt-noprof:
- rm -f $(LIBDIR)/stdlib.p.cmxa; ln -s stdlib.cmxa $(LIBDIR)/stdlib.p.cmxa
- rm -f $(LIBDIR)/stdlib.p.a; ln -s stdlib.a $(LIBDIR)/stdlib.p.a
- rm -f $(LIBDIR)/std_exit.p.cmx; \
- ln -s std_exit.cmx $(LIBDIR)/std_exit.p.cmx
- rm -f $(LIBDIR)/std_exit.p.o; ln -s std_exit.o $(LIBDIR)/std_exit.p.o
-
-installopt-prof:
- cp stdlib.p.cmxa stdlib.p.a std_exit.p.cmx std_exit.p.o $(LIBDIR)
- cd $(LIBDIR); $(RANLIB) stdlib.p.a
-
-stdlib.p.cmxa: $(OBJS:.cmo=.p.cmx)
- $(CAMLOPT) -a -o stdlib.p.cmxa $(OBJS:.cmo=.p.cmx)
-
-#../config/Makefile
-camlheader camlheader_ur: header.c
- if $(SHARPBANGSCRIPTS); then \
- echo '#!$(BINDIR)/ocamlrun' > camlheader && \
- echo '#!' | tr -d '\012' > camlheader_ur; \
- else \
- $(BYTECC) $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) \
- -DRUNTIME_NAME='"$(BINDIR)/ocamlrun"' \
- header.c -o tmpheader$(EXE) && \
- strip tmpheader$(EXE) && \
- mv tmpheader$(EXE) camlheader && \
- cp camlheader camlheader_ur; \
- fi
-
-.NOTPARALLEL: %.p.cmxa %.cmxa
-
-.PHONY: all allopt allopt-noprof allopt-prof install installopt
-.PHONY: installopt-default installopt-noprof installopt-prof clean depend
View
31 src/stdlib/Makefile.nt
@@ -1,31 +0,0 @@
-#########################################################################
-# #
-# 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 GNU Library General Public License, with #
-# the special exception on linking described in file ../LICENSE. #
-# #
-#########################################################################
-
-# $Id$
-
-include Makefile.shared
-
-allopt: stdlib.cmxa std_exit.cmx
-
-installopt:
- cp stdlib.cmxa stdlib.$(A) std_exit.$(O) *.cmx $(LIBDIR)
-
-camlheader camlheader_ur: headernt.c ../config/Makefile
- $(BYTECC) $(BYTECCCOMPOPTS) -c -I../byterun headernt.c
- $(MKEXE) -o tmpheader.exe headernt.$(O) $(EXTRALIBS)
- rm -f camlheader.exe
- mv tmpheader.exe camlheader
- cp camlheader camlheader_ur
-
-# TODO: do not call flexlink to build tmpheader.exe (we don't need
-# the export table)
View
97 src/stdlib/Makefile.shared
@@ -1,97 +0,0 @@
-#########################################################################
-# #
-# 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 GNU Library General Public License, with #
-# the special exception on linking described in file ../LICENSE. #
-# #
-#########################################################################
-
-# $Id$
-
-#include ../config/Makefile
-#RUNTIME=ocamlrun
-COMPILER=ocamlc
-CAMLC=$(RUNTIME) $(COMPILER)
-COMPFLAGS=-strict-sequence -g -warn-error A -nostdlib
-OPTCOMPILER=ocamlopt
-CAMLOPT=$(RUNTIME) $(OPTCOMPILER)
-OPTCOMPFLAGS=-warn-error A -nostdlib -g
-CAMLDEP=ocamldep
-
-OBJS=pervasives.cmo $(OTHERS)
-OTHERS=array.cmo list.cmo char.cmo string.cmo sys.cmo \
- hashtbl.cmo sort.cmo marshal.cmo obj.cmo \
- int32.cmo int64.cmo nativeint.cmo \
- lexing.cmo parsing.cmo \
- set.cmo map.cmo stack.cmo queue.cmo \
- camlinternalLazy.cmo lazy.cmo stream.cmo \
- buffer.cmo printf.cmo format.cmo scanf.cmo \
- arg.cmo printexc.cmo gc.cmo \
- digest.cmo random.cmo callback.cmo \
- camlinternalOO.cmo oo.cmo camlinternalMod.cmo \
- genlex.cmo weak.cmo \
- filename.cmo complex.cmo \
- arrayLabels.cmo listLabels.cmo stringLabels.cmo moreLabels.cmo stdLabels.cmo
-
-all: stdlib.cma std_exit.cmo camlheader camlheader_ur
-
-install:
- cp stdlib.cma std_exit.cmo *.cmi *.mli *.ml camlheader camlheader_ur $(LIBDIR)
-
-stdlib.cma: $(OBJS)
- $(CAMLC) -a -o stdlib.cma $(OBJS)
-
-stdlib.cmxa: $(OBJS:.cmo=.cmx)
- $(CAMLOPT) -a -o stdlib.cmxa $(OBJS:.cmo=.cmx)
-
-sys.ml: sys.mlp ../VERSION
- sed -e "s|%%VERSION%%|`sed -e 1q ../VERSION`|" sys.mlp >sys.ml
-
-clean::
- rm -f sys.ml
-
-clean::
- rm -f camlheader camlheader_ur
-
-.SUFFIXES: .mli .ml .cmi .cmo .cmx .p.cmx
-
-.mli.cmi:
- $(CAMLC) $(COMPFLAGS) `./Compflags $@` -c $<
-
-.ml.cmo:
- $(CAMLC) $(COMPFLAGS) `./Compflags $@` -c $<
-
-.ml.cmx:
- $(CAMLOPT) $(OPTCOMPFLAGS) `./Compflags $@` -c $<
-
-.ml.p.cmx:
- $(CAMLOPT) $(OPTCOMPFLAGS) `./Compflags $@` -p -c -o $*.p.cmx $<
-
-# Dependencies on the compiler
-#$(OBJS) std_exit.cmo: $(COMPILER)
-#$(OBJS:.cmo=.cmi) std_exit.cmi: $(COMPILER)
-#$(OBJS:.cmo=.cmx) std_exit.cmx: $(OPTCOMPILER)
-#$(OBJS:.cmo=.p.cmx) std_exit.p.cmx: $(OPTCOMPILER)
-
-# Dependencies on Pervasives (not tracked by ocamldep)
-$(OBJS) std_exit.cmo: pervasives.cmi
-$(OTHERS:.cmo=.cmi) std_exit.cmi: pervasives.cmi
-$(OBJS:.cmo=.cmx) std_exit.cmx: pervasives.cmi
-$(OBJS:.cmo=.p.cmx) std_exit.p.cmx: pervasives.cmi
-$(OTHERS:.cmo=.cmx) std_exit.cmx: pervasives.cmx
-$(OTHERS:.cmo=.p.cmx) std_exit.p.cmx: pervasives.cmx
-
-clean::
- rm -f *.cm* *.$(O) *.$(A)
- rm -f *~
-
-include .depend
-
-depend:
- $(CAMLDEP) *.mli *.ml > .depend
- $(CAMLDEP) *.ml | sed -e 's/\.cmx/.p.cmx/g' >>.depend
View
49 src/stdlib/StdlibModules
@@ -1,49 +0,0 @@
-# This file lists all standard library modules. -*- Makefile -*-
-# It is used in particular to know what to expunge in toplevels.
-# $Id$
-
-STDLIB_MODULES=\
- arg \
- array \
- arrayLabels \
- buffer \
- callback \
- camlinternalLazy \
- camlinternalMod \
- camlinternalOO \
- char \
- complex \
- digest \
- filename \
- format \
- gc \
- genlex \
- hashtbl \
- int32 \
- int64 \
- lazy \
- lexing \
- list \
- listLabels \
- map \
- marshal \
- moreLabels \
- nativeint \
- obj \
- oo \
- parsing \
- pervasives \
- printexc \
- printf \
- queue \
- random \
- scanf \
- set \
- sort \
- stack \
- stdLabels \
- stream \
- string \
- stringLabels \
- sys \
- weak
View
6 src/stdlib/VERSION
@@ -0,0 +1,6 @@
+3.12.1
+
+# The version string is the first line of this file.
+# It must be in the format described in stdlib/sys.mli
+
+# $Id$
View
14 src/stdlib/_tags
@@ -0,0 +1,14 @@
+# The following rules are used to replace Compflags
+"stdlib.a" or "stdlib.cmxa" or "std_exit.o": precious
+
+true: -use_stdlib, -debug
+
+<*.ml*>: warn_error_A
+
+<pervasives.mli>: nopervasives
+<camlinternalOO.ml>: inline(0)
+<scanf.ml>: inline(9)
+<arrayLabels.ml>: nolabels
+<listLabels.ml>: nolabels
+<stringLabels.ml>: nolabels
+<moreLabels.ml>: nolabels
View
1  src/stdlib/caml
View
18 src/stdlib/myocamlbuild.ml
@@ -0,0 +1,18 @@
+open Ocamlbuild_plugin
+
+let _ =
+(* The version number *)
+rule "sys.ml"
+ ~prod:"sys.ml"
+ ~deps:["sys.mlp"; "VERSION"]
+ begin fun _ _ ->
+ let version = with_input_file "VERSION" input_line in
+ Seq [rm_f "sys.ml";
+ Cmd (S[A"sed"; A"-e";
+ A(Printf.sprintf "s,%%%%VERSION%%%%,%s," version);
+ Sh"<"; P"sys.mlp"; Sh">"; Px"sys.ml"]);
+ chmod (A"-w") "sys.ml"]
+ end;;
+
+(* We are building the standard library so the old one is not needed *)
+flag ["ocaml"; "compile"] (A "-nostdlib")
View
1  src/stdlib/sharpbang
@@ -1 +0,0 @@
-#!
View
3  src/stdlib/stdlib.itarget
@@ -0,0 +1,3 @@
+stdlib.cmxa
+stdlib.a
+std_exit.o
View
86 src/stdlib/sys.ml
@@ -1,86 +0,0 @@
-(***********************************************************************)
-(* *)
-(* Objective Caml *)
-(* *)
-(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
-(* *)
-(* Copyright 1996 Institut National de Recherche en Informatique et *)
-(* en Automatique. All rights reserved. This file is distributed *)
-(* under the terms of the GNU Library General Public License, with *)
-(* the special exception on linking described in file ../LICENSE. *)
-(* *)
-(***********************************************************************)
-
-(* $Id$ *)
-
-(* WARNING: sys.ml is generated from sys.mlp. DO NOT EDIT sys.ml or
- your changes will be lost.
-*)
-
-(* System interface *)
-
-external get_config: unit -> string * int = "caml_sys_get_config"
-external get_argv: unit -> string * string array = "caml_sys_get_argv"
-
-let (executable_name, argv) = get_argv()
-let (os_type, word_size) = get_config()
-let max_array_length = (1 lsl (word_size - 10)) - 1;;
-let max_string_length = word_size / 8 * max_array_length - 1;;
-
-external file_exists: string -> bool = "caml_sys_file_exists"
-external is_directory : string -> bool = "caml_sys_is_directory"
-external remove: string -> unit = "caml_sys_remove"
-external rename : string -> string -> unit = "caml_sys_rename"
-external getenv: string -> string = "caml_sys_getenv"
-external command: string -> int = "caml_sys_system_command"
-external time: unit -> float = "caml_sys_time"
-external chdir: string -> unit = "caml_sys_chdir"
-external getcwd: unit -> string = "caml_sys_getcwd"
-external readdir : string -> string array = "caml_sys_read_directory"
-
-let interactive = ref false
-
-type signal_behavior =
- Signal_default
- | Signal_ignore
- | Signal_handle of (int -> unit)
-
-external signal : int -> signal_behavior -> signal_behavior
- = "caml_install_signal_handler"
-
-let set_signal sig_num sig_beh = ignore(signal sig_num sig_beh)
-
-let sigabrt = -1
-let sigalrm = -2
-let sigfpe = -3
-let sighup = -4
-let sigill = -5
-let sigint = -6
-let sigkill = -7
-let sigpipe = -8
-let sigquit = -9
-let sigsegv = -10
-let sigterm = -11
-let sigusr1 = -12
-let sigusr2 = -13
-let sigchld = -14
-let sigcont = -15
-let sigstop = -16
-let sigtstp = -17
-let sigttin = -18
-let sigttou = -19
-let sigvtalrm = -20
-let sigprof = -21
-
-exception Break
-
-let catch_break on =
- if on then
- set_signal sigint (Signal_handle(fun _ -> raise Break))
- else
- set_signal sigint Signal_default
-
-
-(* The version string is found in file ../VERSION *)
-
-let ocaml_version = "3.12.1";;
Please sign in to comment.
Something went wrong with that request. Please try again.