<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -185,6 +185,11 @@ An alternative, and faster approach to steps 2 to 5 is
 The result is equivalent to &quot;make world opt opt.opt&quot;, but this may
 fail if anything goes wrong in native-code generation.
 
+Another alternative, is to use the experimental build system that use
+ocamlbuild instead of make (it replaces steps 2 to 5):
+
+        ./build/fastworld.sh
+
 6- You can now install the Objective Caml system. This will create the
 following commands (in the binary directory selected during
 autoconfiguration):
@@ -214,6 +219,10 @@ From the top directory, become superuser and do:
         umask 022       # make sure to give read &amp; execute permission to all
         make install
 
+      In the ocamlbuild setting instead of make install do:
+
+        ./build/install.sh
+
 7- Installation is complete. Time to clean up. From the toplevel
 directory, do &quot;make clean&quot;.
 </diff>
      <filename>INSTALL</filename>
    </modified>
    <modified>
      <diff>@@ -124,7 +124,7 @@ defaultentry:
 
 # Recompile the system using the bootstrap compiler
 all: runtime ocamlc ocamllex ocamlyacc ocamltools library ocaml \
-  otherlibraries camlp4out $(DEBUGGER) ocamldoc
+  otherlibraries ocamlbuild.byte camlp4out $(DEBUGGER) ocamldoc
 
 # The compilation of ocaml will fail if the runtime has changed.
 # Never mind, just do make bootstrap to reach fixpoint again.
@@ -228,8 +228,8 @@ opt: runtimeopt ocamlopt libraryopt otherlibrariesopt
 
 # Native-code versions of the tools
 opt.opt: checkstack runtime core ocaml opt-core ocamlc.opt otherlibraries \
-	 camlp4out $(DEBUGGER) ocamldoc ocamlopt.opt otherlibrariesopt \
-	 ocamllex.opt ocamltoolsopt.opt camlp4opt ocamldoc.opt
+	 ocamlbuild.byte camlp4out $(DEBUGGER) ocamldoc ocamlopt.opt otherlibrariesopt \
+	 ocamllex.opt ocamltoolsopt.opt ocamlbuild.native camlp4opt ocamldoc.opt
 
 # Installation
 install: FORCE
@@ -258,10 +258,10 @@ install: FORCE
         done
 	cd ocamldoc; $(MAKE) install
 	if test -f ocamlopt; then $(MAKE) installopt; else :; fi
-	cd camlp4; $(MAKE) install
 	if test -f debugger/ocamldebug; then (cd debugger; $(MAKE) install); \
 	   else :; fi
 	cp config/Makefile $(LIBDIR)/Makefile.config
+	./build/partial-install.sh
 
 # Installation of the native-code compiler
 installopt:
@@ -605,25 +605,25 @@ alldepend::
 
 # Camlp4
 
-camlp4/build/camlp4_config.ml: config/Makefile utils/config.ml
-	(echo 'let prefix = &quot;$(PREFIX)&quot;'; \
-	 echo 'let bindir = &quot;$(BINDIR)&quot;'; \
-	 echo 'let mandir = &quot;$(MANDIR)&quot;'; \
-	 echo 'let libdir = &quot;$(LIBDIR)&quot;'; \
-         grep ast utils/config.ml) &gt; camlp4/build/camlp4_config.ml
-
+camlp4out: ocamlc otherlibraries ocamlbuild-partial-boot ocamlbuild.byte
+	./build/camlp4-byte-only.sh
+camlp4opt: ocamlopt otherlibrariesopt ocamlbuild-partial-boot ocamlbuild.native
+	./build/camlp4-native-only.sh
 partialclean::
-	rm -f camlp4/build/camlp4_config.ml
-beforedepend:: camlp4/build/camlp4_config.ml
+	rm -rf _build/camlp4
+
+# Ocamlbuild
 
-camlp4out: ocamlc camlp4/build/camlp4_config.ml
-	cd camlp4; $(MAKE) all
-camlp4opt: ocamlopt
-	cd camlp4; $(MAKE) opt
+ocamlbuild.byte: ocamlc otherlibraries ocamlbuild-partial-boot
+	./build/ocamlbuild-byte-only.sh
+ocamlbuild.native: ocamlopt otherlibrariesopt ocamlbuild-partial-boot
+	./build/ocamlbuild-native-only.sh
 partialclean::
-	cd camlp4; $(MAKE) clean
-alldepend::
-	cd camlp4; $(MAKE) depend
+	rm -rf _build/ocamlbuild
+
+.PHONY: ocamlbuild-partial-boot
+ocamlbuild-partial-boot:
+	./build/partial-boot.sh
 
 # Check that the stack limit is reasonable.
 </diff>
      <filename>Makefile</filename>
    </modified>
    <modified>
      <diff>@@ -114,7 +114,7 @@ defaultentry:
 	@echo &quot;Please refer to the installation instructions in file README.win32.&quot;
 
 # Recompile the system using the bootstrap compiler
-all: runtime ocamlc ocamllex ocamlyacc ocamltools library ocaml otherlibraries ocamldoc.byte camlp4out win32gui
+all: runtime ocamlc ocamllex ocamlyacc ocamltools library ocaml otherlibraries ocamldoc.byte ocamlbuild.byte camlp4out win32gui
 
 # The compilation of ocaml will fail if the runtime has changed.
 # Never mind, just do make bootstrap to reach fixpoint again.
@@ -202,7 +202,7 @@ opt: runtimeopt ocamlopt libraryopt otherlibrariesopt
 
 # Native-code versions of the tools
 opt.opt: ocamlc.opt ocamlopt.opt ocamllex.opt ocamltoolsopt.opt \
-	camlp4opt ocamldoc.opt
+	ocamlbuild.native camlp4opt ocamldoc.opt
 
 # Installation
 install: installbyt installopt
@@ -228,7 +228,7 @@ installbyt:
 	mkdir -p $(STUBLIBDIR)
 	for i in $(OTHERLIBRARIES); do $(MAKEREC) -C otherlibs/$$i install; done
 	cd win32caml ; $(MAKE) install
-	cd camlp4 ; make install
+	./build/partial-install.sh
 	cp config/Makefile $(LIBDIR)/Makefile.config
 	cp README $(DISTRIB)/Readme.general.txt
 	cp README.win32 $(DISTRIB)/Readme.windows.txt
@@ -564,25 +564,25 @@ alldepend::
 
 # Camlp4
 
-camlp4/build/camlp4_config.ml: config/Makefile utils/config.ml
-	(echo 'let prefix = &quot;$(PREFIX)&quot;'; \
-	 echo 'and bindir = &quot;$(BINDIR)&quot;'; \
-	 echo 'and mandir = &quot;$(MANDIR)&quot;'; \
-	 echo 'and libdir = &quot;$(LIBDIR)&quot;'; \
-         grep 'ast.*magic_number' utils/config.ml) &gt; camlp4/build/camlp4_config.ml
-
+camlp4out: ocamlc otherlibraries ocamlbuild-partial-boot ocamlbuild.byte
+	./build/camlp4-byte-only.sh
+camlp4opt: ocamlopt otherlibrariesopt ocamlbuild-partial-boot ocamlbuild.native
+	./build/camlp4-native-only.sh
 partialclean::
-	rm -f camlp4/build/camlp4_config.ml
-beforedepend:: camlp4/build/camlp4_config.ml
+	rm -rf _build/camlp4
+
+# Ocamlbuild
 
-camlp4out: ocamlc camlp4/build/camlp4_config.ml
-	cd camlp4; $(MAKE) all
-camlp4opt: ocamlopt
-	cd camlp4; $(MAKE) opt
+ocamlbuild.byte: ocamlc otherlibraries ocamlbuild-partial-boot
+	./build/ocamlbuild-byte-only.sh
+ocamlbuild.native: ocamlopt otherlibrariesopt ocamlbuild-partial-boot
+	./build/ocamlbuild-native-only.sh
 partialclean::
-	cd camlp4; $(MAKE) clean
-alldepend::
-	cd camlp4; $(MAKE) depend
+	rm -rf _build/ocamlbuild
+
+.PHONY: ocamlbuild-partial-boot
+ocamlbuild-partial-boot:
+	./build/partial-boot.sh
 
 # The Win32 toplevel GUI
 </diff>
      <filename>Makefile.nt</filename>
    </modified>
    <modified>
      <diff>@@ -124,7 +124,7 @@ Normally, the only variables that need to be changed are
         PREFIX      where to install everything
         TK_ROOT     where TCL/TK was installed
 
-Finally, use &quot;make -f Makefile.nt&quot; to build the system, e.g. 
+Finally, use &quot;make -f Makefile.nt&quot; to build the system, e.g.
 
         make -f Makefile.nt world
         make -f Makefile.nt bootstrap
@@ -132,6 +132,10 @@ Finally, use &quot;make -f Makefile.nt&quot; to build the system, e.g.
         make -f Makefile.nt opt.opt
         make -f Makefile.nt install
 
+Alternatively you can use the experimental build procdure using ocamlbuild:
+
+        ./build/fastworld.sh
+        ./build/install.sh
 
 NOTES:
 </diff>
      <filename>README.win32</filename>
    </modified>
    <modified>
      <diff>@@ -41,6 +41,33 @@ S=s
 SO=s.o
 DO=d.o
 EXE=.exe
+EXT_DLL=.dll
+EXT_OBJ=.$(O)
+EXT_LIB=.$(A)
+EXT_ASM=.$(S)
+MANEXT=1
+SHARPBANGSCRIPTS=false
+PTHREAD_LINK=
+X11_INCLUDES=
+X11_LINK=
+DBM_INCLUDES=
+DBM_LINK=
+BYTECCRPATH=
+SUPPORTS_SHARED_LIBRARIES=true
+SHAREDCCCOMPOPTS=
+MKSHAREDLIBRPATH=
+NATIVECCPROFOPTS=
+NATIVECCRPATH=
+ASFLAGS=
+ASPP=
+ASPPFLAGS=
+ASPPPROFFLAGS=
+PROFILING=noprof
+DYNLINKOPTS=
+DEBUGGER=
+CC_PROFILE=
+SYSTHREAD_SUPPORT=true
+EXTRALIBS=
 
 ########## Configuration for the bytecode compiler
 
@@ -65,17 +92,22 @@ CPP=$(BYTECC) -E
 
 ### How to build an EXE
 MKEXE=$(BYTECC) -o $(1) $(2)
+#ml let mkexe out files opts = Printf.sprintf &quot;%s -o %s %s %s&quot; bytecc out opts files;;
 
 ### How to build a DLL
 MKDLL=$(BYTECC) -shared -o $(1) -Wl,--out-implib,$(2) $(3)
+#ml let mkdll out implib files opts = Printf.sprintf &quot;%s -shared -o %s -Wl,--out-implib,%s %s %s&quot; bytecc out implib files opts;;
 
 ### How to build a static library
 MKLIB=rm -f $(1); ar rcs $(1) $(2)
+#ml let mklib out files opts = Printf.sprintf &quot;rm -f %s &amp;&amp; ar rcs %s %s %s&quot; out opts out files;;
 
 ### Canonicalize the name of a system library
 SYSLIB=-l$(1)
+#ml let syslib x = &quot;-l&quot;^x;;
 
 ### The ranlib command
+RANLIB=ranlib
 RANLIBCMD=ranlib
 
 ############# Configuration for the native-code compiler</diff>
      <filename>config/Makefile.mingw</filename>
    </modified>
    <modified>
      <diff>@@ -41,6 +41,32 @@ S=asm
 SO=s.obj
 DO=d.obj
 EXE=.exe
+EXT_DLL=.dll
+EXT_OBJ=.$(O)
+EXT_LIB=.$(A)
+EXT_ASM=.$(S)
+MANEXT=1
+SHARPBANGSCRIPTS=false
+PTHREAD_LINK=
+X11_INCLUDES=
+X11_LINK=
+DBM_INCLUDES=
+DBM_LINK=
+BYTECCRPATH=
+SUPPORTS_SHARED_LIBRARIES=true
+SHAREDCCCOMPOPTS=
+NATIVECCPROFOPTS=
+NATIVECCRPATH=
+ASFLAGS=
+ASPP=
+ASPPFLAGS=
+ASPPPROFFLAGS=
+PROFILING=noprof
+DYNLINKOPTS=
+DEBUGGER=
+CC_PROFILE=
+SYSTHREAD_SUPPORT=true
+EXTRALIBS=
 
 ########## Configuration for the bytecode compiler
 
@@ -64,24 +90,28 @@ NATIVECCLIBS=advapi32.lib
 CPP=cl /nologo /EP
 
 ### How to merge a .manifest (if any) in a .exe or .dll
-MERGEMANIFEST=\
-  test ! -f $(1).manifest || \
-  mt -nologo -outputresource:$(1) -manifest $(1).manifest &amp;&amp; \
-  rm -f $(1).manifest
+MERGEMANIFEST=test ! -f $(1).manifest || mt -nologo -outputresource:$(1) -manifest $(1).manifest &amp;&amp; rm -f $(1).manifest
+#ml let mergemanifest out = Printf.sprintf &quot;test ! -f %s.manifest || mt -nologo -outputresource:%s -manifest %s.manifest &amp;&amp; rm -f %s.manifest&quot; out out out out;;
 
 ### How to build an EXE
 MKEXE=$(BYTECC) /Fe$(1) $(2) &amp;&amp; ($(MERGEMANIFEST))
+#ml let mkexe out files opts = Printf.sprintf &quot;%s /Fe%s %s %s &amp;&amp; (%s)&quot; bytecc out opts files (mergemanifest out);;
 
 ### How to build a DLL
 MKDLL=link /nologo /dll /out:$(1) /implib:$(2) $(3) &amp;&amp; ($(MERGEMANIFEST))
+#ml let mkdll out implib files opts = Printf.sprintf &quot;link /nologo /dll /out:%s /implib:%s %s %s &amp;&amp; (%s)&quot; out implib opts files (mergemanifest out);;
 
 ### How to build a static library
 MKLIB=link /lib /nologo /out:$(1) $(2)
+#ml let mklib out files opts = Printf.sprintf &quot;link /lib /nologo /out:%s %s %s&quot; out opts files;;
+MKSHAREDLIBRPATH=
 
 ### Canonicalize the name of a system library
 SYSLIB=$(1).lib
+#ml let syslib x = x ^ &quot;.lib&quot;;;
 
 ### The ranlib command
+RANLIB=
 RANLIBCMD=
 
 ############# Configuration for the native-code compiler</diff>
      <filename>config/Makefile.msvc</filename>
    </modified>
    <modified>
      <diff>@@ -42,6 +42,31 @@ SO=s.obj
 DO=d.obj
 DBGO=dbg.obj
 EXE=.exe
+EXT_DLL=.dll
+EXT_OBJ=.$(O)
+EXT_LIB=.$(A)
+EXT_ASM=.$(S)
+MANEXT=1
+SHARPBANGSCRIPTS=false
+PTHREAD_LINK=
+X11_INCLUDES=
+X11_LINK=
+DBM_INCLUDES=
+DBM_LINK=
+BYTECCRPATH=
+SUPPORTS_SHARED_LIBRARIES=true
+SHAREDCCCOMPOPTS=
+NATIVECCPROFOPTS=
+NATIVECCRPATH=
+ASFLAGS=
+ASPP=
+ASPPFLAGS=
+ASPPPROFFLAGS=
+PROFILING=noprof
+DYNLINKOPTS=
+DEBUGGER=
+CC_PROFILE=
+SYSTHREAD_SUPPORT=true
 
 ########## Configuration for the bytecode compiler
 </diff>
      <filename>config/Makefile.msvc64</filename>
    </modified>
    <modified>
      <diff>@@ -986,7 +986,7 @@ elif sh ./hasgot $dllib -ldl dlopen; then
   echo &quot;dlopen() found in -ldl.&quot;
   dllib=&quot;$dllib -ldl&quot;
 else
-  shared_libraries_supported=no
+  shared_libraries_supported=false
 fi
 
 if $shared_libraries_supported; then
@@ -1087,7 +1087,6 @@ if test &quot;$pthread_wanted&quot; = &quot;yes&quot;; then
           nativecccompopts=&quot;$nativecccompopts -pthread&quot;;;
     esac
     echo &quot;Options for linking with POSIX threads: $pthread_link&quot;
-    echo &quot;PTHREAD_LINK=$pthread_link&quot; &gt;&gt; Makefile
     if sh ./hasgot $pthread_link sigwait; then
       echo &quot;sigwait() found&quot;
       echo &quot;#define HAS_SIGWAIT&quot; &gt;&gt; s.h
@@ -1096,7 +1095,10 @@ if test &quot;$pthread_wanted&quot; = &quot;yes&quot;; then
     echo &quot;POSIX threads not found.&quot;
     pthread_link=&quot;&quot;
   fi
+else
+  pthread_link=&quot;&quot;
 fi
+echo &quot;PTHREAD_LINK=$pthread_link&quot; &gt;&gt; Makefile
 
 # Determine if the bytecode thread library is supported
 
@@ -1240,9 +1242,9 @@ else
   else
     x11_include=&quot;-I$x11_include&quot;
   fi
-  echo &quot;X11_INCLUDES=$x11_include&quot; &gt;&gt; Makefile
-  echo &quot;X11_LINK=$x11_link&quot; &gt;&gt; Makefile
 fi
+echo &quot;X11_INCLUDES=$x11_include&quot; &gt;&gt; Makefile
+echo &quot;X11_LINK=$x11_link&quot; &gt;&gt; Makefile
 
 # See if we can compile the dbm library
 
@@ -1284,13 +1286,13 @@ else
   else
     dbm_include=&quot;-I$dbm_include&quot;
   fi
-  echo &quot;DBM_INCLUDES=$dbm_include&quot; &gt;&gt; Makefile
-  echo &quot;DBM_LINK=$dbm_link&quot; &gt;&gt; Makefile
   if test &quot;$use_gdbm_ndbm&quot; = &quot;yes&quot;; then
     echo &quot;#define DBM_USES_GDBM_NDBM&quot; &gt;&gt; s.h
   fi
   otherlibraries=&quot;$otherlibraries dbm&quot;
 fi
+echo &quot;DBM_INCLUDES=$dbm_include&quot; &gt;&gt; Makefile
+echo &quot;DBM_LINK=$dbm_link&quot; &gt;&gt; Makefile
 
 # Look for tcl/tk
 
@@ -1406,6 +1408,8 @@ if test $has_tk = true; then
   otherlibraries=&quot;$otherlibraries labltk&quot;
 else
   echo &quot;Configuration failed, LablTk will not be built.&quot;
+  echo &quot;TK_DEFS=&quot; &gt;&gt; Makefile
+  echo &quot;TK_LINK=&quot; &gt;&gt; Makefile
 fi
 
 # Final twiddling of compiler options to work around known bugs
@@ -1429,8 +1433,22 @@ echo &quot;BYTECCRPATH=$byteccrpath&quot; &gt;&gt; Makefile
 echo &quot;EXE=$exe&quot; &gt;&gt; Makefile
 echo &quot;SUPPORTS_SHARED_LIBRARIES=$shared_libraries_supported&quot; &gt;&gt; Makefile
 echo &quot;SHAREDCCCOMPOPTS=$sharedcccompopts&quot; &gt;&gt; Makefile
-echo &quot;MKSHAREDLIB=$mksharedlib&quot; &gt;&gt; Makefile
 echo &quot;MKSHAREDLIBRPATH=$mksharedlibrpath&quot; &gt;&gt; Makefile
+cat &gt;&gt; Makefile &lt;&lt;EOF
+SYSLIB=-l\$(1)
+#ml let syslib x = \&quot;-l\&quot;^x;;
+
+MKEXE=\$(BYTECC) -o \$(1) \$(2)
+#ml let mkexe out files opts = Printf.sprintf &quot;%s -o %s %s %s&quot; bytecc out opts files;;
+
+### How to build a DLL
+MKDLL=$mksharedlib \$(1) \$(3)
+#ml let mkdll out _implib files opts = Printf.sprintf &quot;%s %s %s %s&quot; &quot;$mksharedlib&quot; out opts files;;
+
+### How to build a static library
+MKLIB=ar rc \$(1) \$(2); ranlib \$(1)
+#ml let mklib out files opts = Printf.sprintf &quot;ar rc %s %s %s; ranlib %s&quot; out opts files out;;
+EOF
 echo &quot;ARCH=$arch&quot; &gt;&gt; Makefile
 echo &quot;MODEL=$model&quot; &gt;&gt; Makefile
 echo &quot;SYSTEM=$system&quot; &gt;&gt; Makefile
@@ -1449,8 +1467,18 @@ echo &quot;DYNLINKOPTS=$dllib&quot; &gt;&gt; Makefile
 echo &quot;OTHERLIBRARIES=$otherlibraries&quot; &gt;&gt; Makefile
 echo &quot;DEBUGGER=$debugger&quot; &gt;&gt; Makefile
 echo &quot;CC_PROFILE=$cc_profile&quot; &gt;&gt; Makefile
-echo &quot;SYSTHREAD_SUPPORT=$systhread_support&quot; &gt;&gt;Makefile
-echo &quot;PARTIALLD=$partialld&quot; &gt;&gt;Makefile
+echo &quot;SYSTHREAD_SUPPORT=$systhread_support&quot; &gt;&gt; Makefile
+echo &quot;PARTIALLD=$partialld&quot; &gt;&gt; Makefile
+echo &quot;DLLCCCOMPOPTS=&quot; &gt;&gt; Makefile
+echo &quot;O=o&quot; &gt;&gt; Makefile
+echo &quot;A=a&quot; &gt;&gt; Makefile
+echo &quot;EXT_OBJ=.o&quot; &gt;&gt; Makefile
+echo &quot;EXT_ASM=.s&quot; &gt;&gt; Makefile
+echo &quot;EXT_LIB=.a&quot; &gt;&gt; Makefile
+echo &quot;EXT_DLL=.so&quot; &gt;&gt; Makefile
+echo &quot;EXTRALIBS=&quot; &gt;&gt; Makefile
+echo &quot;CCOMPTYPE=cc&quot; &gt;&gt; Makefile
+echo &quot;TOOLCHAIN=cc&quot; &gt;&gt; Makefile
 
 rm -f tst hasgot.c
 rm -f ../m.h ../s.h ../Makefile</diff>
      <filename>configure</filename>
    </modified>
    <modified>
      <diff>@@ -54,7 +54,7 @@ partialclean:
 	rm -f *.cm* 
 
 clean: partialclean
-	rm -f libbigarray.* *.o bigarray.a *.so
+	rm -f *.o *.so *.a
 
 .SUFFIXES: .ml .mli .cmo .cmi .cmx
 </diff>
      <filename>otherlibs/bigarray/Makefile</filename>
    </modified>
    <modified>
      <diff>@@ -55,7 +55,7 @@ stdlib.cmxa: $(OBJS:.cmo=.cmx)
 	$(CAMLOPT) -a -o stdlib.cmxa $(OBJS:.cmo=.cmx)
 
 camlheader camlheader_ur: headernt.c ../config/Makefile
-	$(call MKEXE,tmpheader.exe,$(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) headernt.c $(EXTRALIBS))
+	$(call MKEXE,tmpheader.exe,-I../byterun $(BYTECCCOMPOPTS) $(BYTECCLINKOPTS) headernt.c $(EXTRALIBS))
 	rm -f camlheader.exe
 	mv tmpheader.exe camlheader
 	cp camlheader camlheader_ur</diff>
      <filename>stdlib/Makefile.nt</filename>
    </modified>
    <modified>
      <diff>@@ -17,8 +17,8 @@
 #define WIN32_LEAN_AND_MEAN
 
 #include &lt;windows.h&gt;
-#include &quot;../byterun/mlvalues.h&quot;
-#include &quot;../byterun/exec.h&quot;
+#include &quot;mlvalues.h&quot;
+#include &quot;exec.h&quot;
 
 #ifndef __MINGW32__
 #pragma comment(linker , &quot;/entry:headerentry&quot;)</diff>
      <filename>stdlib/headernt.c</filename>
    </modified>
    <modified>
      <diff>@@ -88,8 +88,13 @@ clean::
 
 # To help building mixed-mode libraries (Caml + C)
 
-ocamlmklib: ocamlmklib.cmo
-	$(CAMLC) $(LINKFLAGS) -o ocamlmklib ocamlmklib.cmo
+ocamlmklib: myocamlbuild_config.cmo ocamlmklib.cmo
+	$(CAMLC) $(LINKFLAGS) -o ocamlmklib myocamlbuild_config.cmo ocamlmklib.cmo
+
+ocamlmklib.cmo: myocamlbuild_config.cmi
+myocamlbuild_config.ml: ../config/Makefile
+	../build/mkmyocamlbuild_config.sh
+	cp ../myocamlbuild_config.ml .
 
 install::
 	cp ocamlmklib $(BINDIR)/ocamlmklib</diff>
      <filename>tools/Makefile</filename>
    </modified>
    <modified>
      <diff>@@ -13,18 +13,11 @@
 (* $Id$ *)
 
 open Printf
-
-let bindir = &quot;%%BINDIR%%&quot;
-and supports_shared_libraries = %%SUPPORTS_SHARED_LIBRARIES%%
-and mksharedlib = &quot;%%MKSHAREDLIB%%&quot;
-and bytecc_rpath = &quot;%%BYTECCRPATH%%&quot;
-and nativecc_rpath = &quot;%%NATIVECCRPATH%%&quot;
-and mksharedlib_rpath = &quot;%%MKSHAREDLIBRPATH%%&quot;
-and ranlib = &quot;%%RANLIB%%&quot;
+open Myocamlbuild_config
 
 let bytecode_objs = ref []  (* .cmo,.cma,.ml,.mli files to pass to ocamlc *)
 and native_objs = ref []    (* .cmx,.cmxa,.ml,.mli files to pass to ocamlopt *)
-and c_objs = ref []         (* .o, .a files to pass to mksharedlib and ar *)
+and c_objs = ref []         (* .o, .a, .obj, .lib files to pass to mksharedlib and ar *)
 and caml_libs = ref []      (* -cclib to pass to ocamlc, ocamlopt *)
 and caml_opts = ref []      (* -ccopt to pass to ocamlc, ocamlopt *)
 and dynlink = ref supports_shared_libraries
@@ -37,6 +30,7 @@ and ocamlopt = ref (Filename.concat bindir &quot;ocamlopt&quot;)
 and output = ref &quot;a&quot;        (* Output name for Caml part of library *)
 and output_c = ref &quot;&quot;       (* Output name for C part of library *)
 and rpath = ref []          (* rpath options *)
+and implib = ref &quot;&quot;         (* windows implib flag *)
 and verbose = ref false
 
 let starts_with s pref =
@@ -69,7 +63,7 @@ let parse_arguments argv =
     else if ends_with s &quot;.ml&quot; || ends_with s &quot;.mli&quot; then
      (bytecode_objs := s :: !bytecode_objs;
       native_objs := s :: !native_objs)
-    else if ends_with s &quot;.o&quot; || ends_with s &quot;.a&quot; then
+    else if List.exists (ends_with s) [&quot;.o&quot;; &quot;.a&quot;; &quot;.obj&quot;; &quot;.lib&quot;] then
       c_objs := s :: !c_objs
     else if s = &quot;-cclib&quot; then
       caml_libs := next_arg () :: &quot;-cclib&quot; :: !caml_libs
@@ -77,6 +71,8 @@ let parse_arguments argv =
       caml_opts := next_arg () :: &quot;-ccopt&quot; :: !caml_opts
     else if s = &quot;-custom&quot; then
       dynlink := false
+    else if s = &quot;-implib&quot; then
+      implib := next_arg ()
     else if s = &quot;-I&quot; then
       caml_opts := next_arg () :: &quot;-I&quot; :: !caml_opts
     else if s = &quot;-failsafe&quot; then
@@ -135,7 +131,7 @@ let parse_arguments argv =
   if !output_c = &quot;&quot; then output_c := !output
 
 let usage = &quot;\
-Usage: ocamlmklib [options] &lt;.cmo|.cma|.cmx|.cmxa|.ml|.mli|.o|.a files&gt;
+Usage: ocamlmklib [options] &lt;.cmo|.cma|.cmx|.cmxa|.ml|.mli|.o|.a|.obj|.lib files&gt;
 Options are:
   -cclib &lt;lib&gt;   C library passed to ocamlc -a or ocamlopt -a only
   -ccopt &lt;opt&gt;   C option passed to ocamlc -a or ocamlopt -a only
@@ -202,25 +198,20 @@ let build_libs () =
   if !c_objs &lt;&gt; [] then begin
     if !dynlink then begin
       let retcode = command
-        (sprintf &quot;%s %s %s %s %s %s %s&quot;
-                    mksharedlib
-                    (prepostfix &quot;dll&quot; !output_c &quot;.so&quot;)
+        (mkdll (prepostfix &quot;dll&quot; !output_c ext_dll)
+               !implib
+               (sprintf &quot;%s %s %s %s %s&quot;
                     (String.concat &quot; &quot; !c_objs)
                     (String.concat &quot; &quot; !c_opts)
                     (String.concat &quot; &quot; !ld_opts)
-                    (make_rpath mksharedlib_rpath)
-                    (String.concat &quot; &quot; !c_libs)) in
+                    (make_rpath mksharedlibrpath)
+                    (String.concat &quot; &quot; !c_libs)) &quot;&quot;) in
       if retcode &lt;&gt; 0 then if !failsafe then dynlink := false else exit 2
     end;
-    safe_remove (prepostfix &quot;lib&quot; !output_c &quot;.a&quot;);
-    scommand
-      (sprintf &quot;ar rc %s %s&quot;
-                  (prepostfix &quot;lib&quot; !output_c &quot;.a&quot;)
-                  (String.concat &quot; &quot; !c_objs));
+    safe_remove (prepostfix &quot;lib&quot; !output_c ext_lib);
     scommand
-      (sprintf &quot;%s %s&quot;
-                  ranlib
-                  (prepostfix &quot;lib&quot; !output_c &quot;.a&quot;))
+      (mklib (prepostfix &quot;lib&quot; !output_c ext_lib)
+             (String.concat &quot; &quot; !c_objs) &quot;&quot;);
   end;
   if !bytecode_objs &lt;&gt; [] then
     scommand
@@ -230,10 +221,10 @@ let build_libs () =
                   !output
                   (String.concat &quot; &quot; !caml_opts)
                   (String.concat &quot; &quot; !bytecode_objs)
-                  !output_c
-                  !output_c
+                  (Filename.basename !output_c)
+                  (Filename.basename !output_c)
                   (String.concat &quot; &quot; (prefix_list &quot;-ccopt &quot; !c_opts))
-                  (make_rpath_ccopt bytecc_rpath)
+                  (make_rpath_ccopt byteccrpath)
                   (String.concat &quot; &quot; (prefix_list &quot;-cclib &quot; !c_libs))
                   (String.concat &quot; &quot; !caml_libs));
   if !native_objs &lt;&gt; [] then
@@ -243,9 +234,9 @@ let build_libs () =
                   !output
                   (String.concat &quot; &quot; !caml_opts)
                   (String.concat &quot; &quot; !native_objs)
-                  !output_c
+                  (Filename.basename !output_c)
                   (String.concat &quot; &quot; (prefix_list &quot;-ccopt &quot; !c_opts))
-                  (make_rpath_ccopt nativecc_rpath)
+                  (make_rpath_ccopt nativeccrpath)
                   (String.concat &quot; &quot; (prefix_list &quot;-cclib &quot; !c_libs))
                   (String.concat &quot; &quot; !caml_libs))
 </diff>
      <filename>tools/ocamlmklib.mlp</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2e6f461a61ef70ecd02d322f8553014358ac4eaf</id>
    </parent>
  </parents>
  <author>
    <name>ertai</name>
    <email>ertai</email>
  </author>
  <url>http://github.com/thelema/ocaml-community/commit/6f3044dbb821879720778ad023f96331de5bdd4b</url>
  <id>6f3044dbb821879720778ad023f96331de5bdd4b</id>
  <committed-date>2007-02-07T02:31:35-08:00</committed-date>
  <authored-date>2007-02-07T02:31:35-08:00</authored-date>
  <message>Some changes to the build system</message>
  <tree>ad813dbd6936650ba59c94f9e48c8dd6a903a45a</tree>
  <committer>
    <name>ertai</name>
    <email>ertai</email>
  </committer>
</commit>
