diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1997-10-24 15:51:36 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1997-10-24 15:51:36 +0000 |
commit | 84505b211b41b34b1d2a32b54ad14ccff77b1e6c (patch) | |
tree | 73fd062187a841aba64b247985be6c0fe22e7084 | |
parent | 51a0d78d17ca0de10e0850aa21fcb3ec61a66e00 (diff) |
Si -custom, ajuster le nom de l'executable pour suivre ce que fait
Visual C++.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1736 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | bytecomp/bytelink.ml | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml index 62fd5c8ed..9a2423e90 100644 --- a/bytecomp/bytelink.ml +++ b/bytecomp/bytelink.ml @@ -447,6 +447,17 @@ let append_bytecode_and_cleanup bytecode_name exec_name prim_name = remove_file bytecode_name; remove_file prim_name +(* Fix the name of the output file, if the C compiler changes it behind + our back. *) + +let fix_exec_name name = + match Sys.os_type with + "Win32" -> + begin try String.rindex name '.'; name + with Not_found -> name ^ ".exe" + end + | _ -> name + (* Main entry point (build a custom runtime if needed) *) let link objfiles = @@ -461,9 +472,10 @@ let link objfiles = let poc = open_out prim_name in Symtable.output_primitive_table poc; close_out poc; - if build_custom_runtime prim_name !Clflags.exec_name <> 0 + let exec_name = fix_exec_name !Clflags.exec_name in + if build_custom_runtime prim_name exec_name <> 0 then raise(Error Custom_runtime); - append_bytecode_and_cleanup bytecode_name !Clflags.exec_name prim_name + append_bytecode_and_cleanup bytecode_name exec_name prim_name with x -> remove_file bytecode_name; remove_file prim_name; |