summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorNicolas Pouillard <np@nicolaspouillard.fr>2007-02-07 09:40:59 +0000
committerNicolas Pouillard <np@nicolaspouillard.fr>2007-02-07 09:40:59 +0000
commit1f4ac92f806784f6a9a7199decde2d7cfcb79b03 (patch)
tree54dd8d421c55e36728d5581ed1845e4d76c6cca5 /build
parent381e325c0f7c9f4188c2a4e6421b46d41c0c007c (diff)
downloadocaml-1f4ac92f806784f6a9a7199decde2d7cfcb79b03.tar.gz
Add the build directory, where some script to drive the ocaml compilation lives
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7824 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'build')
-rwxr-xr-xbuild/boot-c-parts-windows.sh29
-rwxr-xr-xbuild/boot-c-parts.sh25
-rwxr-xr-xbuild/boot.sh12
-rwxr-xr-xbuild/camlp4-bootstrap.sh22
-rwxr-xr-xbuild/camlp4-byte-only.sh7
-rwxr-xr-xbuild/camlp4-native-only.sh7
-rw-r--r--build/camlp4-targets.sh31
-rwxr-xr-xbuild/distclean.sh20
-rwxr-xr-xbuild/fastworld.sh31
-rwxr-xr-xbuild/install.sh491
-rwxr-xr-xbuild/mkconfig.sh8
-rwxr-xr-xbuild/mkmyocamlbuild_config.sh39
-rwxr-xr-xbuild/myocamlbuild.sh21
-rw-r--r--build/new-build-system41
-rwxr-xr-xbuild/ocamlbuild-byte-only.sh7
-rwxr-xr-xbuild/ocamlbuild-native-only.sh7
-rw-r--r--build/otherlibs-targets.sh103
-rwxr-xr-xbuild/partial-boot.sh12
-rwxr-xr-xbuild/partial-install.sh153
-rw-r--r--build/targets.sh42
-rwxr-xr-xbuild/world.all.sh11
-rwxr-xr-xbuild/world.byte.sh8
-rwxr-xr-xbuild/world.native.sh9
-rwxr-xr-xbuild/world.sh13
24 files changed, 1149 insertions, 0 deletions
diff --git a/build/boot-c-parts-windows.sh b/build/boot-c-parts-windows.sh
new file mode 100755
index 0000000000..2622ee27e4
--- /dev/null
+++ b/build/boot-c-parts-windows.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+cd `dirname $0`/..
+set -ex
+
+source config/config.sh
+
+(cd byterun && make -f Makefile.nt)
+(cd asmrun && make -f Makefile.nt all meta.$O dynlink.$O)
+(cd yacc && make -f Makefile.nt)
+(cd win32caml && make)
+
+mkdir -p _build/boot
+cp -f byterun/{ocamlrun.exe,libcamlrun.$A,ocamlrun.dll} \
+ asmrun/libasmrun.$A \
+ yacc/ocamlyacc.exe \
+ boot/ocamlc \
+ boot/ocamllex \
+ boot/ocamldep \
+ _build/boot
+mkdir -p _build/byterun
+cp -f byterun/ocamlrun.exe byterun/ocamlrun.dll boot
+cp -f byterun/ocamlrun.$A _build/byterun
+mkdir -p _build/stdlib
+cp -f byterun/libcamlrun.$A \
+ asmrun/libasmrun.$A \
+ _build/stdlib
+mkdir -p _build/asmrun
+cp -f asmrun/{meta,dynlink}.$O \
+ _build/asmrun
diff --git a/build/boot-c-parts.sh b/build/boot-c-parts.sh
new file mode 100755
index 0000000000..5146a4fdba
--- /dev/null
+++ b/build/boot-c-parts.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+cd `dirname $0`/..
+set -ex
+
+# Create a bunch of symlinks to _build/{boot,stdlib,asmrun}
+mkdir -p _build/boot
+ln -sf ../../byterun/{ocamlrun,libcamlrun.a} \
+ ../../asmrun/libasmrun{,p}.a \
+ ../../yacc/ocamlyacc \
+ ../../boot/ocamlc \
+ ../../boot/ocamllex \
+ ../../boot/ocamldep \
+ _build/boot
+ln -sf ../byterun/ocamlrun boot
+mkdir -p _build/stdlib
+ln -sf ../../byterun/libcamlrun.a \
+ ../../asmrun/libasmrun{,p}.a \
+ _build/stdlib
+mkdir -p _build/asmrun
+ln -sf ../../asmrun/{meta,dynlink}.o \
+ _build/asmrun
+
+(cd byterun && make)
+(cd asmrun && make all meta.o dynlink.o)
+(cd yacc && make)
diff --git a/build/boot.sh b/build/boot.sh
new file mode 100755
index 0000000000..91eb42038c
--- /dev/null
+++ b/build/boot.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+cd `dirname $0`/..
+set -ex
+./boot/ocamlrun boot/myocamlbuild.boot boot/stdlib.cma boot/std_exit.cmo
+boot/ocamlrun boot/myocamlbuild.boot -log _boot_log1 \
+ ocamlbuild/ocamlbuildlightlib.cma ocamlbuild/ocamlbuildlight.byte
+rm -f _build/myocamlbuild
+boot/ocamlrun boot/myocamlbuild.boot \
+ -just-plugin -install-dir _build/ocamlbuild -byte-plugin
+cp _build/myocamlbuild boot/myocamlbuild
+./boot/ocamlrun boot/myocamlbuild $@ -log _boot_log2 \
+ boot/camlheader ocamlc
diff --git a/build/camlp4-bootstrap.sh b/build/camlp4-bootstrap.sh
new file mode 100755
index 0000000000..6b1b6d7fae
--- /dev/null
+++ b/build/camlp4-bootstrap.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -e
+cd `dirname $0`/..
+
+TMPTARGETS="\
+ camlp4/boot/Lexer.ml"
+
+TARGETS="\
+ camlp4/boot/Camlp4.ml \
+ camlp4/boot/camlp4boot.ml"
+
+if [ -x ./boot/myocamlbuild.native ]; then
+ OCAMLBUILD=./boot/myocamlbuild.native
+else
+ OCAMLBUILD="./boot/ocamlrun boot/myocamlbuild"
+fi
+$OCAMLBUILD $TMPTARGETS $TARGETS
+
+for t in $TARGETS; do
+ echo promote $t
+ cp _build/$t $t
+done
diff --git a/build/camlp4-byte-only.sh b/build/camlp4-byte-only.sh
new file mode 100755
index 0000000000..e1854ab4d0
--- /dev/null
+++ b/build/camlp4-byte-only.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+export OCAMLBUILD_PARTIAL="true"
+cd `dirname $0`/..
+source build/targets.sh
+set -x
+$OCAMLBUILD $@ $OCAMLC_BYTE $OCAMLLEX_BYTE $CAMLP4_BYTE
diff --git a/build/camlp4-native-only.sh b/build/camlp4-native-only.sh
new file mode 100755
index 0000000000..bc3031d4e0
--- /dev/null
+++ b/build/camlp4-native-only.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+export OCAMLBUILD_PARTIAL="true"
+cd `dirname $0`/..
+source build/targets.sh
+set -x
+$OCAMLBUILD $@ $OCAMLOPT_BYTE $OCAMLLEX_BYTE $CAMLP4_NATIVE
diff --git a/build/camlp4-targets.sh b/build/camlp4-targets.sh
new file mode 100644
index 0000000000..32b55db64b
--- /dev/null
+++ b/build/camlp4-targets.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+CAMLP4_COMMON="\
+ camlp4/Camlp4/Camlp4Ast.partial.ml \
+ camlp4/boot/camlp4boot.byte"
+CAMLP4_BYTE="$CAMLP4_COMMON \
+ camlp4/Camlp4.cmo \
+ camlp4/Camlp4Top.cmo \
+ camlp4/camlp4prof.byte$EXE \
+ camlp4/mkcamlp4.byte$EXE \
+ camlp4/camlp4.byte$EXE"
+CAMLP4_NATIVE="$CAMLP4_COMMON \
+ camlp4/Camlp4.cmx \
+ camlp4/Camlp4Top.cmx \
+ camlp4/camlp4prof.native$EXE \
+ camlp4/mkcamlp4.native$EXE \
+ camlp4/camlp4.native$EXE"
+
+for i in camlp4boot camlp4r camlp4rf camlp4o camlp4of camlp4oof camlp4orf; do
+ CAMLP4_BYTE="$CAMLP4_BYTE camlp4/$i.byte$EXE camlp4/$i.cma"
+ CAMLP4_NATIVE="$CAMLP4_NATIVE camlp4/$i.native$EXE"
+done
+
+cd camlp4
+for dir in Camlp4Parsers Camlp4Printers Camlp4Filters; do
+ for file in $dir/*.ml; do
+ base=camlp4/$dir/`basename $file .ml`
+ CAMLP4_BYTE="$CAMLP4_BYTE $base.cmo"
+ CAMLP4_NATIVE="$CAMLP4_NATIVE $base.cmx $base.$O"
+ done
+done
+cd ..
diff --git a/build/distclean.sh b/build/distclean.sh
new file mode 100755
index 0000000000..dc2a77b0a5
--- /dev/null
+++ b/build/distclean.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+cd `dirname $0`/..
+set -ex
+(cd byterun && make clean)
+(cd asmrun && make clean)
+(cd yacc && make clean)
+rm -rf _build
+rm -f boot/ocamlrun boot/ocamlrun.exe boot/camlheader \
+ boot/myocamlbuild boot/myocamlbuild.native boot/myocamlbuild.native.exe \
+ myocamlbuild_config.ml config/config.sh config/Makefile \
+ config/s.h config/m.h boot/*.cm* _log _*_log*
+
+# from partial boot
+rm -f driver/main.byte driver/optmain.byte lex/main.byte \
+ tools/ocamlmklib.byte camlp4/build/location.ml{,i} \
+ tools/myocamlbuild_config.ml camlp4/build/linenum.ml{i,l} \
+ camlp4/build/terminfo.ml{i,}
+
+# from the old build system
+rm -f camlp4/build/camlp4_config.ml
diff --git a/build/fastworld.sh b/build/fastworld.sh
new file mode 100755
index 0000000000..d3e6ddca36
--- /dev/null
+++ b/build/fastworld.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+cd `dirname $0`
+set -e
+./mkconfig.sh
+./mkmyocamlbuild_config.sh
+source ../config/config.sh
+if [ "x$EXE" = "x.exe" ]; then
+ ./boot-c-parts-windows.sh
+else
+ ./boot-c-parts.sh
+fi
+./boot.sh $@
+
+cd ..
+source build/targets.sh
+OCAMLMKLIB_BYTE="tools/ocamlmklib.byte"
+set -x
+$OCAMLBUILD $@ -log _boot_fast_log \
+ $STDLIB_BYTE $OCAMLOPT_BYTE $STDLIB_NATIVE \
+ $OCAMLOPT_NATIVE $OCAMLMKLIB_BYTE $OTHERLIBS_UNIX_NATIVE $OCAMLBUILD_NATIVE
+
+rm -f _build/myocamlbuild
+boot/ocamlrun boot/myocamlbuild \
+ -just-plugin -install-dir _build/ocamlbuild \
+ -ocamlopt "../_build/ocamlopt.opt -nostdlib -I boot -I stdlib -I $UNIXDIR"
+cp _build/myocamlbuild boot/myocamlbuild.native
+
+./boot/myocamlbuild.native $@ \
+ $OCAMLC_NATIVE $TOPLEVEL $OTHERLIBS_BYTE $OTHERLIBS_NATIVE $OCAMLLEX_BYTE \
+ $OCAMLLEX_NATIVE $TOOLS_BYTE $TOOLS_NATIVE $DEBUGGER \
+ $OCAMLDOC_BYTE $OCAMLDOC_NATIVE $OCAMLBUILD_BYTE $CAMLP4_BYTE $CAMLP4_NATIVE
diff --git a/build/install.sh b/build/install.sh
new file mode 100755
index 0000000000..673e35f3ae
--- /dev/null
+++ b/build/install.sh
@@ -0,0 +1,491 @@
+#!/bin/sh
+set -e
+
+cd `dirname $0`/..
+
+source config/config.sh
+
+not_installed=$PWD/_build/not_installed
+
+rm -f $not_installed
+
+wontinstall() {
+ echo $1 >> $not_installed
+}
+
+installbin() {
+ if [ -f "$1" ]; then
+ echo " install binary $2"
+ cp -f $1 $2
+ [ -x $2 ] || chmod +x $2
+ else
+ wontinstall $1
+ fi
+}
+
+installbestbin() {
+ if [ -f "$1" ]; then
+ echo " install binary $3 (with `basename $1`)"
+ cp -f $1 $3
+ else
+ if [ -f "$2" ]; then
+ echo " install binary $3 (with `basename $2`)"
+ cp -f $2 $3
+ else
+ echo "None of $1, $2 exists"
+ exit 3
+ fi
+ fi
+ [ -x $3 ] || chmod +x $3
+}
+
+installlib() {
+ if [ -f "$1" ]; then
+ dest=$2/`basename $1`
+ echo " install library $dest"
+ cp -f $1 $2
+ ranlib $dest
+ else
+ wontinstall $1
+ fi
+}
+
+installdir() {
+ args=""
+ while [ $# -gt 1 ]; do
+ if [ -f "$1" ]; then
+ args="$args $1"
+ else
+ wontinstall $1
+ fi
+ shift
+ done
+ last=$1
+ for file in $args; do
+ echo " install $last/`basename $file`"
+ cp -f $file $last
+ done
+}
+
+installlibdir() {
+ args=""
+ while [ $# -gt 1 ]; do
+ args="$args $1"
+ shift
+ done
+ last=$1
+ for file in $args; do
+ installlib $file $last
+ done
+}
+
+mkdir -p $BINDIR
+mkdir -p $LIBDIR
+mkdir -p $LIBDIR/caml
+mkdir -p $LIBDIR/camlp4
+mkdir -p $LIBDIR/vmthreads
+mkdir -p $LIBDIR/threads
+mkdir -p $LIBDIR/labltk
+mkdir -p $LIBDIR/ocamlbuild
+mkdir -p $LIBDIR/ocamldoc
+mkdir -p $STUBLIBDIR
+mkdir -p $MANDIR/man3
+mkdir -p $MANDIR/man$MANEXT
+
+echo "Installing core libraries..."
+installlibdir byterun/libcamlrun.{$A,p.$A} \
+ asmrun/libasmrun.{$A,p.$A} \
+ asmrun/libasmrunp.{$A,p.$A} \
+ $LIBDIR
+
+PUBLIC_INCLUDES="\
+ alloc.h callback.h config.h custom.h fail.h intext.h \
+ memory.h misc.h mlvalues.h printexc.h signals.h compatibility.h"
+
+cd byterun
+for i in $PUBLIC_INCLUDES; do
+ echo " install caml/$i"
+ sed -f ../tools/cleanup-header $i > $LIBDIR/caml/$i
+done
+cd ..
+
+installdir byterun/ocamlrun.dll yacc/ocamlyacc byterun/ocamlrun $BINDIR
+
+installdir byterun/ld.conf $LIBDIR
+
+installbin win32caml/ocamlwin.exe $PREFIX/OCamlWin.exe
+
+cd _build
+
+echo "Installing the toplevel and compilers..."
+installbin ocaml$EXE $BINDIR/ocaml$EXE
+installbin ocamlc$EXE $BINDIR/ocamlc$EXE
+installbin ocamlopt$EXE $BINDIR/ocamlopt$EXE
+installbin ocamlc.opt$EXE $BINDIR/ocamlc.opt$EXE
+installbin ocamlopt.opt$EXE $BINDIR/ocamlopt.opt$EXE
+
+set=set # coloration workaround
+
+echo "Installing the standard library..."
+installdir \
+ stdlib/stdlib.cma \
+ stdlib/stdlib{,.p}.cmxa \
+ stdlib/camlheader \
+ stdlib/camlheader_ur \
+ stdlib/std_exit.cm[io] \
+ stdlib/arg.{cmi,mli} \
+ stdlib/array.{cmi,mli} \
+ stdlib/arrayLabels.{cmi,mli} \
+ stdlib/buffer.{cmi,mli} \
+ stdlib/callback.{cmi,mli} \
+ stdlib/camlinternalMod.{cmi,mli} \
+ stdlib/camlinternalOO.{cmi,mli} \
+ stdlib/char.{cmi,mli} \
+ stdlib/complex.{cmi,mli} \
+ stdlib/digest.{cmi,mli} \
+ stdlib/filename.{cmi,mli} \
+ stdlib/format.{cmi,mli} \
+ stdlib/gc.{cmi,mli} \
+ stdlib/genlex.{cmi,mli} \
+ stdlib/hashtbl.{cmi,mli} \
+ stdlib/int32.{cmi,mli} \
+ stdlib/int64.{cmi,mli} \
+ stdlib/lazy.{cmi,mli} \
+ stdlib/lexing.{cmi,mli} \
+ stdlib/list.{cmi,mli} \
+ stdlib/listLabels.{cmi,mli} \
+ stdlib/map.{cmi,mli} \
+ stdlib/marshal.{cmi,mli} \
+ stdlib/moreLabels.{cmi,mli} \
+ stdlib/nativeint.{cmi,mli} \
+ stdlib/obj.{cmi,mli} \
+ stdlib/oo.{cmi,mli} \
+ stdlib/parsing.{cmi,mli} \
+ stdlib/pervasives.{cmi,mli} \
+ stdlib/printexc.{cmi,mli} \
+ stdlib/printf.{cmi,mli} \
+ stdlib/queue.{cmi,mli} \
+ stdlib/random.{cmi,mli} \
+ stdlib/scanf.{cmi,mli} \
+ stdlib/sort.{cmi,mli} \
+ stdlib/stack.{cmi,mli} \
+ stdlib/stdLabels.{cmi,mli} \
+ stdlib/stream.{cmi,mli} \
+ stdlib/string.{cmi,mli} \
+ stdlib/stringLabels.{cmi,mli} \
+ stdlib/sys.{cmi,mli} \
+ stdlib/weak.{cmi,mli} \
+ stdlib/$set.{cmi,mli} \
+ stdlib/arg{,.p}.{cmx,$O} \
+ stdlib/array{,.p}.{cmx,$O} \
+ stdlib/arrayLabels{,.p}.{cmx,$O} \
+ stdlib/buffer{,.p}.{cmx,$O} \
+ stdlib/callback{,.p}.{cmx,$O} \
+ stdlib/camlinternalMod{,.p}.{cmx,$O} \
+ stdlib/camlinternalOO{,.p}.{cmx,$O} \
+ stdlib/char{,.p}.{cmx,$O} \
+ stdlib/complex{,.p}.{cmx,$O} \
+ stdlib/digest{,.p}.{cmx,$O} \
+ stdlib/filename{,.p}.{cmx,$O} \
+ stdlib/format{,.p}.{cmx,$O} \
+ stdlib/gc{,.p}.{cmx,$O} \
+ stdlib/genlex{,.p}.{cmx,$O} \
+ stdlib/hashtbl{,.p}.{cmx,$O} \
+ stdlib/int32{,.p}.{cmx,$O} \
+ stdlib/int64{,.p}.{cmx,$O} \
+ stdlib/lazy{,.p}.{cmx,$O} \
+ stdlib/lexing{,.p}.{cmx,$O} \
+ stdlib/list{,.p}.{cmx,$O} \
+ stdlib/listLabels{,.p}.{cmx,$O} \
+ stdlib/map{,.p}.{cmx,$O} \
+ stdlib/marshal{,.p}.{cmx,$O} \
+ stdlib/moreLabels{,.p}.{cmx,$O} \
+ stdlib/nativeint{,.p}.{cmx,$O} \
+ stdlib/obj{,.p}.{cmx,$O} \
+ stdlib/oo{,.p}.{cmx,$O} \
+ stdlib/parsing{,.p}.{cmx,$O} \
+ stdlib/pervasives{,.p}.{cmx,$O} \
+ stdlib/printexc{,.p}.{cmx,$O} \
+ stdlib/printf{,.p}.{cmx,$O} \
+ stdlib/queue{,.p}.{cmx,$O} \
+ stdlib/random{,.p}.{cmx,$O} \
+ stdlib/scanf{,.p}.{cmx,$O} \
+ stdlib/sort{,.p}.{cmx,$O} \
+ stdlib/stack{,.p}.{cmx,$O} \
+ stdlib/stdLabels{,.p}.{cmx,$O} \
+ stdlib/std_exit{,.p}.{cmx,$O} \
+ stdlib/stream{,.p}.{cmx,$O} \
+ stdlib/string{,.p}.{cmx,$O} \
+ stdlib/stringLabels{,.p}.{cmx,$O} \
+ stdlib/sys{,.p}.{cmx,$O} \
+ stdlib/weak{,.p}.{cmx,$O} \
+ stdlib/$set{,.p}.{cmx,$O} \
+ $LIBDIR
+
+installlibdir \
+ stdlib/stdlib.{$A,p.$A} \
+ $LIBDIR
+
+echo "Installing ocamllex, ocamldebug..."
+installbin lex/ocamllex$EXE $BINDIR/ocamllex$EXE
+installbin debugger/ocamldebug$EXE $BINDIR/ocamldebug$EXE
+installbin lex/ocamllex.opt$EXE $BINDIR/ocamllex.opt$EXE
+installbin tools/ocamldep.native$EXE $BINDIR/ocamldep.opt$EXE
+
+echo "Installing some tools..."
+installbin tools/ocamlcp.byte$EXE $BINDIR/ocamlcp$EXE
+installbin tools/ocamldep.byte$EXE $BINDIR/ocamldep$EXE
+installbin tools/ocamlmklib.byte$EXE $BINDIR/ocamlmklib$EXE
+installbin tools/ocamlmktop.byte$EXE $BINDIR/ocamlmktop$EXE
+installbin tools/ocamlprof.byte$EXE $BINDIR/ocamlprof$EXE
+installbin toplevel/expunge.byte$EXE $LIBDIR/expunge$EXE
+installbin tools/addlabels.byte $LIBDIR/addlabels
+installbin tools/scrapelabels.byte $LIBDIR/scrapelabels
+installbin otherlibs/dynlink/extract_crc.byte $LIBDIR/extract_crc
+installbin otherlibs/labltk/lib/labltk$EXE $BINDIR/labltk$EXE
+installbin otherlibs/labltk/compiler/tkcompiler$EXE $BINDIR/tkcompiler$EXE
+installbin otherlibs/labltk/browser/ocamlbrowser$EXE $BINDIR/ocamlbrowser$EXE
+installbin otherlibs/labltk/compiler/pp$EXE $LIBDIR/labltk/pp$EXE
+installbin otherlibs/labltk/lib/labltktop$EXE $LIBDIR/labltk/labltktop$EXE
+
+echo "Installing libraries..."
+installdir \
+ otherlibs/bigarray/bigarray.cma \
+ otherlibs/dbm/dbm.cma \
+ otherlibs/dynlink/dynlink.cma \
+ otherlibs/{,win32}graph/graphics.cma \
+ otherlibs/num/nums.cma \
+ otherlibs/str/str.cma \
+ otherlibs/{,win32}unix/unix.cma \
+ otherlibs/bigarray/bigarray{,.p}.cmxa \
+ otherlibs/dbm/dbm{,.p}.cmxa \
+ otherlibs/{,win32}graph/graphics{,.p}.cmxa \
+ otherlibs/num/nums{,.p}.cmxa \
+ otherlibs/str/str{,.p}.cmxa \
+ otherlibs/{,win32}unix/unix{,.p}.cmxa \
+ toplevel/toplevellib.cma \
+ otherlibs/systhreads/thread.mli \
+ otherlibs/systhreads/mutex.mli \
+ otherlibs/systhreads/condition.mli \
+ otherlibs/systhreads/event.mli \
+ otherlibs/systhreads/threadUnix.mli \
+ $LIBDIR
+
+installdir \
+ otherlibs/labltk/support/fileevent.{mli,cmi,cmx} \
+ otherlibs/labltk/support/protocol.{mli,cmi,cmx} \
+ otherlibs/labltk/support/textvariable.{mli,cmi,cmx} \
+ otherlibs/labltk/support/timer.{mli,cmi,cmx} \
+ otherlibs/labltk/support/rawwidget.{mli,cmi,cmx} \
+ otherlibs/labltk/support/widget.{mli,cmi,cmx} \
+ otherlibs/labltk/support/tkthread.{mli,cmi,cmo} \
+ otherlibs/labltk/support/tkthread.$O \
+ otherlibs/labltk/labltk/*.mli \
+ otherlibs/labltk/labltk/*.cmi \
+ otherlibs/labltk/labltk/*.cmx \
+ otherlibs/labltk/camltk/*.mli \
+ otherlibs/labltk/camltk/*.cmi \
+ otherlibs/labltk/camltk/*.cmx \
+ otherlibs/labltk/frx/frxlib.cma \
+ otherlibs/labltk/frx/frxlib.cmxa \
+ otherlibs/labltk/frx/*.mli \
+ otherlibs/labltk/frx/*.cmi \
+ otherlibs/labltk/frx/*.cmx \
+ otherlibs/labltk/jpf/jpflib.cma \
+ otherlibs/labltk/jpf/jpflib.cmxa \
+ otherlibs/labltk/jpf/*.mli \
+ otherlibs/labltk/jpf/*.cmi \
+ otherlibs/labltk/jpf/*.cmx \
+ otherlibs/labltk/lib/labltk.cma \
+ otherlibs/labltk/lib/labltk.cmxa \
+ otherlibs/labltk/tkanim/*.mli \
+ otherlibs/labltk/tkanim/*.cmi \
+ otherlibs/labltk/tkanim/tkanim.cma \
+ otherlibs/labltk/tkanim/tkanim.cmxa \
+ $LIBDIR/labltk
+
+installdir \
+ otherlibs/systhreads/threads.cma \
+ otherlibs/systhreads/threads{,.p}.cmxa \
+ otherlibs/systhreads/thread.cmi \
+ otherlibs/systhreads/mutex.cmi \
+ otherlibs/systhreads/condition.cmi \
+ otherlibs/systhreads/event.cmi \
+ otherlibs/systhreads/threadUnix.cmi \
+ $LIBDIR/threads
+
+installdir \
+ otherlibs/bigarray/dllbigarray$EXT_DLL \
+ otherlibs/dbm/dllmldbm$EXT_DLL \
+ otherlibs/{,win32}graph/dllgraphics$EXT_DLL \
+ otherlibs/num/dllnums$EXT_DLL \
+ otherlibs/str/dllstr$EXT_DLL \
+ otherlibs/systhreads/dllthreads$EXT_DLL \
+ otherlibs/{,win32}unix/dllunix$EXT_DLL \
+ otherlibs/threads/dllvmthreads$EXT_DLL \
+ otherlibs/labltk/support/dlllabltk$EXT_DLL \
+ otherlibs/labltk/tkanim/dlltkanim$EXT_DLL \
+ $STUBLIBDIR
+
+installlibdir \
+ otherlibs/threads/libvmthreads.$A \
+ $LIBDIR/vmthreads
+
+installdir \
+ otherlibs/threads/thread.{cmi,mli} \
+ otherlibs/threads/mutex.{cmi,mli} \
+ otherlibs/threads/condition.{cmi,mli} \
+ otherlibs/threads/event.{cmi,mli} \
+ otherlibs/threads/threadUnix.{cmi,mli} \
+ otherlibs/threads/threads.cma \
+ otherlibs/threads/stdlib.cma \
+ otherlibs/threads/unix.cma \
+ $LIBDIR/vmthreads
+
+installlibdir \
+ otherlibs/labltk/support/liblabltk.$A \
+ otherlibs/labltk/lib/labltk.$A \
+ otherlibs/labltk/jpf/jpflib.$A \
+ otherlibs/labltk/tkanim/libtkanim.$A \
+ otherlibs/labltk/tkanim/tkanim.$A \
+ otherlibs/labltk/frx/frxlib.$A \
+ $LIBDIR/labltk
+
+installlibdir \
+ otherlibs/bigarray/libbigarray.{$A,p.$A} \
+ otherlibs/dbm/libmldbm.{$A,p.$A} \
+ otherlibs/{,win32}graph/libgraphics.{$A,p.$A} \
+ otherlibs/num/libnums.{$A,p.$A} \
+ otherlibs/str/libstr.{$A,p.$A} \
+ otherlibs/systhreads/libthreads.{$A,p.$A} \
+ otherlibs/systhreads/libthreadsnat.{$A,p.$A} \
+ otherlibs/{,win32}unix/libunix.{$A,p.$A} \
+ $LIBDIR
+
+echo "Installing object files and interfaces..."
+installdir \
+ tools/profiling.cm{o,i} \
+ toplevel/topstart.cmo \
+ toplevel/toploop.cmi \
+ toplevel/topdirs.cmi \
+ toplevel/topmain.cmi \
+ typing/outcometree.cmi \
+ otherlibs/{,win32}graph/graphicsX11.cmi \
+ otherlibs/dynlink/dynlink.cmi \
+ otherlibs/num/arith_status.cmi \
+ otherlibs/num/big_int.cmi \
+ otherlibs/num/nat.cmi \
+ otherlibs/num/num.cmi \
+ otherlibs/num/ratio.cmi \
+ otherlibs/bigarray/bigarray.cmi \
+ otherlibs/dbm/dbm.cmi \
+ otherlibs/{,win32}graph/graphics.cmi \
+ otherlibs/str/str.cmi \
+ otherlibs/{,win32}unix/unix.cmi \
+ otherlibs/{,win32}unix/unixLabels.cmi \
+ otherlibs/num/arith_flags{,.p}.{cmx,$O} \
+ otherlibs/num/int_misc{,.p}.{cmx,$O} \
+ otherlibs/num/arith_status{,.p}.{cmx,$O} \
+ otherlibs/num/big_int{,.p}.{cmx,$O} \
+ otherlibs/num/nat{,.p}.{cmx,$O} \
+ otherlibs/num/num{,.p}.{cmx,$O} \
+ otherlibs/num/ratio{,.p}.{cmx,$O} \
+ otherlibs/bigarray/bigarray{,.p}.{cmx,$O} \
+ otherlibs/dbm/dbm{,.p}.{cmx,$O} \
+ otherlibs/{,win32}graph/graphics{,.p}.{cmx,$O} \
+ otherlibs/str/str{,.p}.{cmx,$O} \
+ otherlibs/{,win32}unix/unix{,.p}.{cmx,$O} \
+ otherlibs/{,win32}unix/unixLabels{,.p}.{cmx,$O} \
+ $LIBDIR
+
+installlibdir \
+ otherlibs/bigarray/bigarray.{$A,p.$A} \
+ otherlibs/dbm/dbm.{$A,p.$A} \
+ otherlibs/{,win32}graph/graphics.{$A,p.$A} \
+ otherlibs/num/nums.{$A,p.$A} \
+ otherlibs/str/str.{$A,p.$A} \
+ otherlibs/{,win32}unix/unix.{$A,p.$A} \
+ stdlib/stdlib.{$A,p.$A} \
+ $LIBDIR
+
+installlibdir \
+ otherlibs/systhreads/threads.{$A,p.$A} \
+ $LIBDIR/threads
+
+echo "Installing manuals..."
+(cd ../man && make install)
+
+echo "Installing ocamldoc..."
+installbin ocamldoc/ocamldoc$EXE $BINDIR/ocamldoc$EXE
+installbin ocamldoc/ocamldoc.opt$EXE $BINDIR/ocamldoc.opt$EXE
+
+installdir \
+ ../ocamldoc/ocamldoc.hva \
+ ocamldoc/*.cmi \
+ ocamldoc/odoc_info.{mli,cm[ia],cmxa,$A} \
+ $LIBDIR/ocamldoc
+
+installdir \
+ ocamldoc/stdlib_man/* \
+ $MANDIR/man3
+
+echo "Installing camlp4..."
+installbin camlp4/camlp4prof.byte$EXE $BINDIR/camlp4prof$EXE
+installbin camlp4/mkcamlp4.byte$EXE $BINDIR/mkcamlp4$EXE
+installbin camlp4/camlp4.byte$EXE $BINDIR/camlp4$EXE
+installbin camlp4/camlp4o.byte$EXE $BINDIR/camlp4o$EXE
+installbin camlp4/camlp4of.byte$EXE $BINDIR/camlp4of$EXE
+installbin camlp4/camlp4oof.byte$EXE $BINDIR/camlp4oof$EXE
+installbin camlp4/camlp4orf.byte$EXE $BINDIR/camlp4orf$EXE
+installbin camlp4/camlp4r.byte$EXE $BINDIR/camlp4r$EXE
+installbin camlp4/camlp4rf.byte$EXE $BINDIR/camlp4rf$EXE
+installbin camlp4/camlp4o.native$EXE $BINDIR/camlp4o.opt$EXE
+installbin camlp4/camlp4of.native$EXE $BINDIR/camlp4of.opt$EXE
+installbin camlp4/camlp4oof.native$EXE $BINDIR/camlp4oof.opt$EXE
+installbin camlp4/camlp4orf.native$EXE $BINDIR/camlp4orf.opt$EXE
+installbin camlp4/camlp4r.native$EXE $BINDIR/camlp4r.opt$EXE
+installbin camlp4/camlp4rf.native$EXE $BINDIR/camlp4rf.opt$EXE
+
+cd camlp4
+CAMLP4DIR=$LIBDIR/camlp4
+for dir in Camlp4Parsers Camlp4Printers Camlp4Filters Camlp4Top; do
+ echo "Installing $dir..."
+ mkdir -p $CAMLP4DIR/$dir
+ for file in $dir/*.cm*; do
+ echo " install $CAMLP4DIR/$file"
+ cp $file $CAMLP4DIR/$dir
+ done
+ for file in $dir/*.$O; do
+ echo " install $CAMLP4DIR/$file"
+ cp $file $CAMLP4DIR/$dir
+ base=`basename $file .$O`
+ installdir $dir/$base.p.$O $CAMLP4DIR/$dir
+ done
+done
+installdir \
+ camlp4lib.{cma,cmxa} Camlp4.cmi \
+ {camlp4o,camlp4of,camlp4oof,camlp4orf,camlp4r,camlp4rf}.cma \
+ Camlp4Bin.{cm[iox],$O,p.$O} Camlp4Top.cm[io] \
+ $CAMLP4DIR
+installlibdir camlp4lib.{$A,p.$A} $CAMLP4DIR
+cd ..
+
+echo "Installing ocamlbuild..."
+
+installbin ocamlbuild/ocamlbuild.byte$EXE $BINDIR/ocamlbuild.byte$EXE
+installbin ocamlbuild/ocamlbuild.native$EXE $BINDIR/ocamlbuild.native$EXE
+installbestbin ocamlbuild/ocamlbuild.native$EXE ocamlbuild/ocamlbuild.byte$EXE $BINDIR/ocamlbuild$EXE
+
+installlibdir \
+ ocamlbuild/ocamlbuildlib.{$A,p.$A} \
+ $LIBDIR/ocamlbuild
+
+installdir \
+ ocamlbuild/ocamlbuildlib{,.p}.cmxa \
+ ocamlbuild/ocamlbuildlib.cma \
+ ocamlbuild/ocamlbuild_plugin.cmi \
+ ocamlbuild/ocamlbuild_pack.cmi \
+ ocamlbuild/ocamlbuild.cmo \
+ ocamlbuild/ocamlbuild{,.p}.{cmx,$O} \
+ $LIBDIR/ocamlbuild
+
diff --git a/build/mkconfig.sh b/build/mkconfig.sh
new file mode 100755
index 0000000000..7d786d8a4f
--- /dev/null
+++ b/build/mkconfig.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+cd `dirname $0`/..
+
+sed -e 's/\$(\([^)]*\))/${\1}/g' \
+ -e 's/^\([^=]*\)=\([^"]*\)$/\1="\2"/' \
+ -e 's/^\(.*\$([0-9]).*\)$/# \1/' \
+ config/Makefile > config/config.sh
diff --git a/build/mkmyocamlbuild_config.sh b/build/mkmyocamlbuild_config.sh
new file mode 100755
index 0000000000..9bd64b9759
--- /dev/null
+++ b/build/mkmyocamlbuild_config.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+cd `dirname $0`/..
+
+sed \
+ -e 's/^#ml \(.*\)/\1/' \
+ -e 's/\\"/"/g' \
+ -e 's/^\(#.*\)$/(* \1 *)/' \
+ -e 's/^\(.*\$([0-9]).*\)$/(* \1 *)/' \
+ -e 's/^\([^(=]*\)=\([^"]*\)$/let <lower>\1<\/lower> = "\2";;/' \
+ -e 's/\$(\([^)]*\))/"\^<lower>\1<\/lower>\^"/g' \
+ -e 's/""\^//g' \
+ -e 's/\^""//g' \
+ -e 's/^let <lower>\(MAKE\|DO\).*$//g' \
+ -e 's/"true"/true/g' \
+ -e 's/"false"/false/g' \
+ config/Makefile > myocamlbuild_config.tmp.ml
+
+#
+# Some gory awk script to workaround the \L sed feature
+# that is only part of gnused.
+#
+awk '{
+ x = $0 ;
+ while (x ~ /<lower>/) {
+ i = index(x, "<lower>");
+ j = index(x, "</lower>");
+ xi = substr(x, 0, i - 1);
+ i2 = i + length("<lower>");
+ xj = substr(x, i2, j - i2);
+ k = j + length("</lower>");
+ xk = substr(x, k, length(x) - k + 1);
+ x = sprintf("%s%s%s", xi, tolower(xj), xk)
+ };
+ printf("%s\n", x) }' \
+ < myocamlbuild_config.tmp.ml > myocamlbuild_config.ml
+
+rm -f myocamlbuild_config.tmp.ml
+
diff --git a/build/myocamlbuild.sh b/build/myocamlbuild.sh
new file mode 100755
index 0000000000..a219bdce76
--- /dev/null
+++ b/build/myocamlbuild.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+cd `dirname $0`/..
+set -xe
+if [ ! -x _build/ocamlbuild/ocamlbuildlight.byte ]; then
+ if [ ! -x ocamlbuild/_build/ocamlbuildlight.byte ]; then
+ (cd ocamlbuild && make)
+ fi
+ mkdir -p _build/ocamlbuild
+ cp ocamlbuild/_build/ocamlbuild{light{.cmo,.byte,lib.cma},_plugin.cmi,_pack.cmi} _build/ocamlbuild
+fi
+rm -rf _build/myocamlbuild boot/myocamlbuild boot/myocamlbuild.native
+./boot/ocamlrun _build/ocamlbuild/ocamlbuildlight.byte -no-hygiene \
+ -install-dir _build/ocamlbuild -byte-plugin -just-plugin
+cp _build/myocamlbuild boot/myocamlbuild.boot
+# cp boot/myocamlbuild boot/myocamlbuild.boot
+# rm -f boot/myocamlbuild.boot
+# boot/myocamlbuild.native
+# ocamlbuildlight -build-dir _build_myocamlbuild_boot -byte-plugin -no-hygiene
+# cp _build_myocamlbuild_boot/myocamlbuild boot/myocamlbuild.boot
+# ocamlbuild -build-dir _build_myocamlbuild_native -no-hygiene
+# cp _build_myocamlbuild_native/myocamlbuild boot/myocamlbuild.native
diff --git a/build/new-build-system b/build/new-build-system
new file mode 100644
index 0000000000..b16f6deb83
--- /dev/null
+++ b/build/new-build-system
@@ -0,0 +1,41 @@
+_tags # Defines tags to setup exceptions
+myocamlbuild.ml # Contains all needed rules that are differents
+boot/ocamldep
+myocamlbuild_config.mli
+utils/config.mlbuild # Should be renamed as utils/config.ml
+
+# Files that just contain module names of object files.
+**/*.mllib # Files that describe the contents of an OCaml library
+**/*.mlpack # Files that describe the contents of an OCaml package
+**/*.cilb # Files that describe the contents of an C static library
+**/*.dilb # Files that describe the contents of an C dynamic library
+
+build/
+ world.sh # Build all the OCaml world
+ fastworld.sh # Same as above but faster
+ boot-c-parts.sh # Compile byterun, ocamlyacc and asmrun with the Makefiles
+ boot-c-parts-windows.sh # Same as boot-c-parts.sh but for windows
+ boot.sh # Compile the stdlib and ocamlc
+ camlp4-targets.sh # Setup camlp4 targets
+ otherlibs-targets.sh # Setup otherlibs targets
+ targets.sh # All targets of the OCaml distribution
+
+ world.byte.sh # Build the bytecode world
+ world.native.sh # Build the native world
+ world.all.sh # Build all the world the don't bootstrap
+
+ install.sh # Install all needed files
+ distclean.sh # Clean all generated files
+
+ myocamlbuild.sh # Regenerate the boot/myocamlbuild program
+ mkconfig.sh # Generate config/config.sh
+ mkmyocamlbuild_config.sh # Generate myocamlbuild_config.ml
+
+ camlp4-bootstrap.sh
+
+ # Partial stuffs (just camlp4 and ocamlbuild)
+ partial-boot.sh
+ camlp4-byte-only.sh
+ camlp4-native-only.sh
+ ocamlbuild-byte-only.sh
+ ocamlbuild-native-only.sh
diff --git a/build/ocamlbuild-byte-only.sh b/build/ocamlbuild-byte-only.sh
new file mode 100755
index 0000000000..5db69c328d
--- /dev/null
+++ b/build/ocamlbuild-byte-only.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+export OCAMLBUILD_PARTIAL="true"
+cd `dirname $0`/..
+source build/targets.sh
+set -x
+$OCAMLBUILD $@ $OCAMLC_BYTE $OCAMLLEX_BYTE $OCAMLBUILD_BYTE
diff --git a/build/ocamlbuild-native-only.sh b/build/ocamlbuild-native-only.sh
new file mode 100755
index 0000000000..3354d58c4a
--- /dev/null
+++ b/build/ocamlbuild-native-only.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+export OCAMLBUILD_PARTIAL="true"
+cd `dirname $0`/..
+source build/targets.sh
+set -x
+$OCAMLBUILD $@ $OCAMLOPT_BYTE $OCAMLLEX_BYTE $OCAMLBUILD_NATIVE
diff --git a/build/otherlibs-targets.sh b/build/otherlibs-targets.sh
new file mode 100644
index 0000000000..46eafbd48c
--- /dev/null
+++ b/build/otherlibs-targets.sh
@@ -0,0 +1,103 @@
+#!/bin/sh
+OTHERLIBS_BYTE=""
+OTHERLIBS_NATIVE=""
+OTHERLIBS_UNIX_NATIVE=""
+UNIXDIR="otherlibs/unix"
+
+add_native() {
+ for native_file in $@; do
+ OTHERLIBS_NATIVE="$OTHERLIBS_NATIVE otherlibs/$lib/$native_file"
+ case $lib in
+ unix|win32unix)
+ OTHERLIBS_UNIX_NATIVE="$OTHERLIBS_UNIX_NATIVE otherlibs/$lib/$native_file";;
+ esac
+ done
+}
+
+add_byte() {
+ for byte_file in $@; do
+ OTHERLIBS_BYTE="$OTHERLIBS_BYTE otherlibs/$lib/$byte_file"
+ done
+}
+
+add_file() {
+ add_byte $@
+ add_native $@
+}
+
+add_bin() {
+ for bin_file in $@; do
+ add_byte $bin_file.byte$EXE
+ add_native $bin_file.native$EXE
+ done
+}
+
+add_c_lib() {
+ add_file "lib$1.$A"
+}
+
+add_ocaml_lib() {
+ add_native "$1.cmxa"
+ add_byte "$1.cma"
+}
+
+add_dll() {
+ add_file "dll$1$EXT_DLL"
+}
+
+add() {
+ add_c_lib $1
+ add_ocaml_lib $1
+ add_dll $1
+}
+
+THREADS_CMIS="thread.cmi mutex.cmi condition.cmi event.cmi threadUnix.cmi"
+
+for lib in $OTHERLIBRARIES; do
+ case $lib in
+ num)
+ add nums;;
+ systhreads)
+ add_ocaml_lib threads
+ add_dll threads
+ add_file $THREADS_CMIS
+ add_byte libthreads.$A
+ add_native libthreadsnat.$A;;
+ graph|win32graph)
+ add graphics;;
+ threads)
+ add_byte pervasives.cmi pervasives.mli \
+ $THREADS_CMIS marshal.cmi marshal.mli \
+ stdlib.cma unix.cma threads.cma libvmthreads.$A;;
+ labltk)
+ add_file support/camltk.h
+ add_byte support/byte.otarget
+ add_native support/native.otarget
+ add_file support/liblabltk.$A
+ add_byte compiler/tkcompiler$EXE compiler/pp$EXE
+ add_file labltk/tk.ml labltk/labltk.ml
+ add_byte labltk/byte.otarget
+ add_native labltk/native.otarget
+ add_byte camltk/byte.otarget
+ add_native camltk/native.otarget
+ add_ocaml_lib lib/labltk
+ add_byte lib/labltktop$EXE lib/labltk$EXE
+ add_ocaml_lib jpf/jpflib
+ add_ocaml_lib frx/frxlib
+ add_ocaml_lib tkanim/tkanim
+ add_file tkanim/libtkanim.$A
+ add_byte browser/ocamlbrowser$EXE
+ ;;
+ dbm)
+ add_ocaml_lib dbm
+ add_c_lib mldbm;;
+ dynlink)
+ add_byte $lib.cmi $lib.cma extract_crc;;
+ win32unix)
+ UNIXDIR="otherlibs/win32unix"
+ add_file unixsupport.h cst2constr.h socketaddr.h
+ add unix;;
+ *)
+ add $lib
+ esac
+done
diff --git a/build/partial-boot.sh b/build/partial-boot.sh
new file mode 100755
index 0000000000..de6d5644d7
--- /dev/null
+++ b/build/partial-boot.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -ex
+cd `dirname $0`/..
+export OCAMLBUILD_PARTIAL="true"
+mkdir -p _build
+cp -rf boot _build/
+cp parsing/location.ml{,i} camlp4/build
+cp parsing/linenum.ml{l,i} camlp4/build
+cp utils/terminfo.ml{,i} camlp4/build
+./build/mkconfig.sh
+./build/mkmyocamlbuild_config.sh
+./build/boot.sh
diff --git a/build/partial-install.sh b/build/partial-install.sh
new file mode 100755
index 0000000000..3f581e68b5
--- /dev/null
+++ b/build/partial-install.sh
@@ -0,0 +1,153 @@
+#!/bin/sh
+
+######################################
+######### Copied from build/install.sh
+######################################
+
+set -e
+
+cd `dirname $0`/..
+
+source config/config.sh
+
+not_installed=$PWD/_build/not_installed
+
+rm -f $not_installed
+
+wontinstall() {
+ echo $1 >> $not_installed
+}
+
+installbin() {
+ if [ -f "$1" ]; then
+ echo " install $2"
+ cp -f $1 $2
+ [ -x $2 ] || chmod +x $2
+ else
+ wontinstall $1
+ fi
+}
+
+installbestbin() {
+ if [ -f "$1" ]; then
+ echo " install binary $3 (with `basename $1`)"
+ cp -f $1 $3
+ else
+ if [ -f "$2" ]; then
+ echo " install binary $3 (with `basename $2`)"
+ cp -f $2 $3
+ else
+ echo "None of $1, $2 exists"
+ exit 3
+ fi
+ fi
+ [ -x $3 ] || chmod +x $3
+}
+
+installlib() {
+ if [ -f "$1" ]; then
+ dest=$2/`basename $1`
+ echo " install library $dest"
+ cp -f $1 $2
+ ranlib $dest
+ else
+ wontinstall $1
+ fi
+}
+
+installdir() {
+ args=""
+ while [ $# -gt 1 ]; do
+ if [ -f "$1" ]; then
+ args="$args $1"
+ else
+ wontinstall $1
+ fi
+ shift
+ done
+ last=$1
+ for file in $args; do
+ echo " install $last/`basename $file`"
+ cp -f $file $last
+ done
+}
+
+installlibdir() {
+ args=""
+ while [ $# -gt 1 ]; do
+ args="$args $1"
+ shift
+ done
+ last=$1
+ for file in $args; do
+ installlib $file $last
+ done
+}
+
+mkdir -p $BINDIR
+mkdir -p $LIBDIR
+mkdir -p $LIBDIR/camlp4
+mkdir -p $LIBDIR/ocamlbuild
+mkdir -p $STUBLIBDIR
+
+cd _build
+
+echo "Installing camlp4..."
+installbin camlp4/camlp4prof.byte$EXE $BINDIR/camlp4prof$EXE
+installbin camlp4/mkcamlp4.byte$EXE $BINDIR/mkcamlp4$EXE
+installbin camlp4/camlp4.byte$EXE $BINDIR/camlp4$EXE
+installbin camlp4/camlp4o.byte$EXE $BINDIR/camlp4o$EXE
+installbin camlp4/camlp4of.byte$EXE $BINDIR/camlp4of$EXE
+installbin camlp4/camlp4oof.byte$EXE $BINDIR/camlp4oof$EXE
+installbin camlp4/camlp4orf.byte$EXE $BINDIR/camlp4orf$EXE
+installbin camlp4/camlp4r.byte$EXE $BINDIR/camlp4r$EXE
+installbin camlp4/camlp4rf.byte$EXE $BINDIR/camlp4rf$EXE
+installbin camlp4/camlp4o.native$EXE $BINDIR/camlp4o.opt$EXE
+installbin camlp4/camlp4of.native$EXE $BINDIR/camlp4of.opt$EXE
+installbin camlp4/camlp4oof.native$EXE $BINDIR/camlp4oof.opt$EXE
+installbin camlp4/camlp4orf.native$EXE $BINDIR/camlp4orf.opt$EXE
+installbin camlp4/camlp4r.native$EXE $BINDIR/camlp4r.opt$EXE
+installbin camlp4/camlp4rf.native$EXE $BINDIR/camlp4rf.opt$EXE
+
+cd camlp4
+CAMLP4DIR=$LIBDIR/camlp4
+for dir in Camlp4Parsers Camlp4Printers Camlp4Filters Camlp4Top; do
+ echo "Installing $dir..."
+ mkdir -p $CAMLP4DIR/$dir
+ for file in $dir/*.cm*; do
+ echo " install $CAMLP4DIR/$file"
+ cp $file $CAMLP4DIR/$dir
+ done
+ for file in $dir/*.$O; do
+ echo " install $CAMLP4DIR/$file"
+ cp $file $CAMLP4DIR/$dir
+ base=`basename $file .$O`
+ installdir $dir/$base.p.$O $CAMLP4DIR/$dir
+ done
+done
+installdir \
+ camlp4lib.{cma,cmxa} Camlp4.cmi \
+ {camlp4o,camlp4of,camlp4oof,camlp4orf,camlp4r,camlp4rf}.cma \
+ Camlp4Bin.{cm[iox],$O,p.$O} Camlp4Top.cm[io] \
+ $CAMLP4DIR
+installlibdir camlp4lib.{$A,p.$A} $CAMLP4DIR
+cd ..
+
+echo "Installing ocamlbuild..."
+
+installbin ocamlbuild/ocamlbuild.byte$EXE $BINDIR/ocamlbuild.byte$EXE
+installbin ocamlbuild/ocamlbuild.native$EXE $BINDIR/ocamlbuild.native$EXE
+installbestbin ocamlbuild/ocamlbuild.native$EXE ocamlbuild/ocamlbuild.byte$EXE $BINDIR/ocamlbuild$EXE
+
+installlibdir \
+ ocamlbuild/ocamlbuildlib.{$A,p.$A} \
+ $LIBDIR/ocamlbuild
+
+installdir \
+ ocamlbuild/ocamlbuildlib{,.p}.cmxa \
+ ocamlbuild/ocamlbuildlib.cma \
+ ocamlbuild/ocamlbuild_plugin.cmi \
+ ocamlbuild/ocamlbuild_pack.cmi \
+ ocamlbuild/ocamlbuild.cmo \
+ ocamlbuild/ocamlbuild{,.p}.{cmx,$O} \
+ $LIBDIR/ocamlbuild
diff --git a/build/targets.sh b/build/targets.sh
new file mode 100644
index 0000000000..01ebb844c3
--- /dev/null
+++ b/build/targets.sh
@@ -0,0 +1,42 @@
+source config/config.sh
+source build/otherlibs-targets.sh
+source build/camlp4-targets.sh
+STDLIB_BYTE="stdlib/stdlib.cma stdlib/std_exit.cmo \
+ stdlib/camlheader stdlib/camlheader_ur"
+OCAMLLEX_BYTE=lex/ocamllex$EXE
+OCAMLC_BYTE=ocamlc$EXE
+OCAMLOPT_BYTE=ocamlopt$EXE
+OCAMLBUILD_BYTE="ocamlbuild/ocamlbuildlib.cma \
+ ocamlbuild/ocamlbuildlightlib.cma \
+ ocamlbuild/ocamlbuild.byte$EXE \
+ ocamlbuild/ocamlbuildlight.byte$EXE"
+TOPLEVEL=ocaml$EXE
+TOOLS_BYTE="tools/ocamldep.byte$EXE tools/profiling.cmo \
+ tools/ocamlprof.byte$EXE tools/ocamlcp.byte$EXE \
+ tools/ocamlmktop.byte$EXE tools/ocamlmklib$EXE \
+ tools/scrapelabels.byte tools/addlabels.byte \
+ tools/dumpobj.byte$EXE"
+if [ ! -z "$DEBUGGER" ]; then
+ DEBUGGER=debugger/ocamldebug$EXE
+fi
+OCAMLDOC_BYTE="ocamldoc/ocamldoc$EXE ocamldoc/odoc_info.cma"
+STDLIB_NATIVE="stdlib/stdlib.cmxa stdlib/std_exit.cmx"
+case $PROFILING in
+prof) STDLIB_NATIVE="$STDLIB_NATIVE stdlib/stdlib.p.cmxa stdlib/std_exit.p.cmx";;
+noprof) ;;
+*) echo "unexpected PROFILING value $PROFILING"; exit 1;;
+esac
+OCAMLC_NATIVE=ocamlc.opt$EXE
+OCAMLOPT_NATIVE=ocamlopt.opt$EXE
+OCAMLLEX_NATIVE=lex/ocamllex.opt$EXE
+TOOLS_NATIVE=tools/ocamldep.native$EXE
+OCAMLDOC_NATIVE="ocamldoc/ocamldoc.opt$EXE ocamldoc/odoc_info.cmxa ocamldoc/stdlib_man/Pervasives.3o"
+OCAMLBUILD_NATIVE="ocamlbuild/ocamlbuildlib.cmxa \
+ ocamlbuild/ocamlbuildlightlib.cmxa \
+ ocamlbuild/ocamlbuild.native$EXE \
+ ocamlbuild/ocamlbuildlight.native$EXE"
+if [ -x boot/myocamlbuild.native ]; then
+ OCAMLBUILD=./boot/myocamlbuild.native
+else
+ OCAMLBUILD="./boot/ocamlrun boot/myocamlbuild"
+fi
diff --git a/build/world.all.sh b/build/world.all.sh
new file mode 100755
index 0000000000..edbb8ee5eb
--- /dev/null
+++ b/build/world.all.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -e
+cd `dirname $0`/..
+source build/targets.sh
+set -x
+$OCAMLBUILD $@ \
+ $STDLIB_BYTE $OCAMLC_BYTE $OCAMLLEX_BYTE $OCAMLOPT_BYTE $TOPLEVEL \
+ $TOOLS_BYTE $OTHERLIBS_BYTE $OCAMLBUILD_BYTE $DEBUGGER $OCAMLDOC_BYTE \
+ $CAMLP4_BYTE $STDLIB_NATIVE $OCAMLC_NATIVE $OCAMLOPT_NATIVE \
+ $OCAMLLEX_NATIVE $TOOLS_NATIVE $OTHERLIBS_NATIVE \
+ $OCAMLBUILD_NATIVE $OCAMLDOC_NATIVE $CAMLP4_NATIVE
diff --git a/build/world.byte.sh b/build/world.byte.sh
new file mode 100755
index 0000000000..3809095744
--- /dev/null
+++ b/build/world.byte.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+cd `dirname $0`/..
+source build/targets.sh
+set -x
+$OCAMLBUILD $@ \
+ $STDLIB_BYTE $OCAMLC_BYTE $OCAMLLEX_BYTE $OCAMLOPT_BYTE $TOPLEVEL $TOOLS_BYTE \
+ $OTHERLIBS_BYTE $OCAMLBUILD_BYTE $DEBUGGER $OCAMLDOC_BYTE $CAMLP4_BYTE
diff --git a/build/world.native.sh b/build/world.native.sh
new file mode 100755
index 0000000000..f3eb693aa6
--- /dev/null
+++ b/build/world.native.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+cd `dirname $0`/..
+source build/targets.sh
+set -x
+$OCAMLBUILD $@ \
+ $STDLIB_NATIVE $OCAMLC_NATIVE $OCAMLOPT_NATIVE \
+ $OCAMLLEX_NATIVE $TOOLS_NATIVE $OTHERLIBS_NATIVE \
+ $OCAMLBUILD_NATIVE $OCAMLDOC_NATIVE $CAMLP4_NATIVE
diff --git a/build/world.sh b/build/world.sh
new file mode 100755
index 0000000000..8c576c7d3f
--- /dev/null
+++ b/build/world.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+cd `dirname $0`
+set -ex
+./mkconfig.sh
+./mkmyocamlbuild_config.sh
+source ../config/config.sh
+if [ "x$EXE" = "x.exe" ]; then
+ ./boot-c-parts-windows.sh
+else
+ ./boot-c-parts.sh
+fi
+./boot.sh $@
+./world.all.sh $@