1(*
2    Copyright (c) 2006-10, 2015-16  David C. J. Matthews
3
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License version 2.1 as published by the Free Software Foundation.
7    
8    This library is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11    Lesser General Public License for more details.
12    
13    You should have received a copy of the GNU Lesser General Public
14    License along with this library; if not, write to the Free Software
15    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16*)
17
18(* Compiler the compiler and export it as a portable file.  The rest of the
19   bootstrap process is then done when the portable file is imported. *)
20
21PolyML.print_depth 0;
22
23PolyML.make "mlsource/MLCompiler";
24
25fun compileBasisAndExport() =
26let
27    (* This function is the root of the "pre-built" compilers.  It compiles in
28       the basis library and exports the compiler along with the basis library
29       as an operating-system specific object file. *)
30    val globalTable : Make.gEnv = Make.makeGEnv ()
31    val test = List.exists (fn "--intIsIntInf" => true | _ => false) (CommandLine.arguments())
32    val () = Initialise.initGlobalEnv{globalTable=globalTable, intIsArbitraryPrecision=test}
33in
34    Make.shellProc globalTable()
35end;
36
37PolyML.shareCommonData compileBasisAndExport;
38
39PolyML.exportPortable("polytemp",
40    fn () => (compileBasisAndExport (); OS.Process.exit OS.Process.success) handle _ => OS.Process.exit OS.Process.failure);
41