diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2004-06-13 12:46:41 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2004-06-13 12:46:41 +0000 |
commit | 3dce37c1963ca174eab9f03b9636170e1ecded6e (patch) | |
tree | 532b7b7b8439a837207ad6da7b993c6e03a99f86 /driver/compile.ml | |
parent | 2955927a88bbd1ba882f01e35750cf068c73b16c (diff) |
Generalisation de l'option -o
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6395 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'driver/compile.ml')
-rw-r--r-- | driver/compile.ml | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/driver/compile.ml b/driver/compile.ml index 52cf87d4a..5f065ff81 100644 --- a/driver/compile.ml +++ b/driver/compile.ml @@ -50,10 +50,10 @@ let initial_env () = (* Compile a .mli file *) -let interface ppf sourcefile = +let interface ppf sourcefile outputprefix = init_path(); - let prefixname = chop_extension_if_any sourcefile in - let modulename = String.capitalize(Filename.basename prefixname) in + let modulename = + String.capitalize(Filename.basename(chop_extension_if_any sourcefile)) in let inputfile = Pparse.preprocess sourcefile in try let ast = @@ -65,7 +65,7 @@ let interface ppf sourcefile = (Typemod.simplify_signature sg); Warnings.check_fatal (); if not !Clflags.print_types then - Env.save_signature sg modulename (prefixname ^ ".cmi"); + Env.save_signature sg modulename (outputprefix ^ ".cmi"); Pparse.remove_preprocessed inputfile with e -> Pparse.remove_preprocessed_if_ast inputfile; @@ -79,27 +79,27 @@ let print_if ppf flag printer arg = let (++) x f = f x -let implementation ppf sourcefile = +let implementation ppf sourcefile outputprefix = init_path(); - let prefixname = chop_extension_if_any sourcefile in - let modulename = String.capitalize(Filename.basename prefixname) in + let modulename = + String.capitalize(Filename.basename(chop_extension_if_any sourcefile)) in let inputfile = Pparse.preprocess sourcefile in let env = initial_env() in if !Clflags.print_types then begin try ignore( Pparse.file ppf inputfile Parse.implementation ast_impl_magic_number ++ print_if ppf Clflags.dump_parsetree Printast.implementation - ++ Typemod.type_implementation sourcefile prefixname modulename env) + ++ Typemod.type_implementation sourcefile outputprefix modulename env) with x -> Pparse.remove_preprocessed_if_ast inputfile; raise x end else begin - let objfile = prefixname ^ ".cmo" in + let objfile = outputprefix ^ ".cmo" in let oc = open_out_bin objfile in try Pparse.file ppf inputfile Parse.implementation ast_impl_magic_number ++ print_if ppf Clflags.dump_parsetree Printast.implementation - ++ Typemod.type_implementation sourcefile prefixname modulename env + ++ Typemod.type_implementation sourcefile outputprefix modulename env ++ Translmod.transl_implementation modulename ++ print_if ppf Clflags.dump_rawlambda Printlambda.lambda ++ Simplif.simplify_lambda |