Add cmo/cma/cmx/cmxa cases to OCAMLPARAM
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13764 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
a04798140b
commit
db98eb647c
|
@ -58,6 +58,8 @@ let first_ccopts = ref []
|
|||
let last_ccopts = ref []
|
||||
let first_ppx = ref []
|
||||
let last_ppx = ref []
|
||||
let first_objfiles = ref []
|
||||
let last_objfiles = ref []
|
||||
|
||||
(* Note: this function is duplicated in optcompile.ml *)
|
||||
let check_unit_name ppf filename name =
|
||||
|
@ -297,6 +299,27 @@ let read_OCAMLPARAM position =
|
|||
first_ppx := v :: !first_ppx
|
||||
end
|
||||
|
||||
|
||||
| "cmo" | "cma" ->
|
||||
if not !native_code then
|
||||
begin
|
||||
match position with
|
||||
| Before_link | Before_compile ->
|
||||
last_objfiles := v ::! last_objfiles
|
||||
| Before_args ->
|
||||
first_objfiles := v :: !first_objfiles
|
||||
end
|
||||
|
||||
| "cmx" | "cmxa" ->
|
||||
if !native_code then
|
||||
begin
|
||||
match position with
|
||||
| Before_link | Before_compile ->
|
||||
last_objfiles := v ::! last_objfiles
|
||||
| Before_args ->
|
||||
first_objfiles := v :: !first_objfiles
|
||||
end
|
||||
|
||||
| _ ->
|
||||
Printf.eprintf
|
||||
"Warning: discarding value of variable %S in OCAMLCOMPPARAM\n%!"
|
||||
|
@ -310,7 +333,11 @@ let readenv position =
|
|||
last_include_dirs := [];
|
||||
last_ccopts := [];
|
||||
last_ppx := [];
|
||||
last_objfiles := [];
|
||||
read_OCAMLPARAM position;
|
||||
all_ccopts := !last_ccopts @ !first_ccopts;
|
||||
all_ppx := !last_ppx @ !first_ppx
|
||||
|
||||
let get_objfiles () =
|
||||
List.rev (!last_objfiles @ !objfiles @ !first_objfiles)
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@ val first_include_dirs : string list ref
|
|||
val last_include_dirs : string list ref
|
||||
val implicit_modules : string list ref
|
||||
|
||||
(* return the list of objfiles, after OCAMLPARAM and List.rev *)
|
||||
val get_objfiles : unit -> string list
|
||||
|
||||
type readenv_position =
|
||||
Before_args | Before_compile | Before_link
|
||||
|
||||
|
|
|
@ -150,14 +150,14 @@ let main () =
|
|||
if !make_archive then begin
|
||||
Compmisc.init_path false;
|
||||
|
||||
Bytelibrarian.create_archive ppf (List.rev !objfiles)
|
||||
Bytelibrarian.create_archive ppf (Compenv.get_objfiles ())
|
||||
(extract_output !output_name);
|
||||
Warnings.check_fatal ();
|
||||
end
|
||||
else if !make_package then begin
|
||||
Compmisc.init_path false;
|
||||
let extracted_output = extract_output !output_name in
|
||||
let revd = List.rev !objfiles in
|
||||
let revd = get_objfiles () in
|
||||
Bytepackager.package_files ppf revd (extracted_output);
|
||||
Warnings.check_fatal ();
|
||||
end
|
||||
|
@ -179,7 +179,7 @@ let main () =
|
|||
default_output !output_name
|
||||
in
|
||||
Compmisc.init_path false;
|
||||
Bytelink.link ppf (List.rev !objfiles) target;
|
||||
Bytelink.link ppf (get_objfiles ()) target;
|
||||
Warnings.check_fatal ();
|
||||
end;
|
||||
exit 0
|
||||
|
|
|
@ -164,19 +164,19 @@ let main () =
|
|||
fatal "Option -a cannot be used with .cmxa input files.";
|
||||
Compmisc.init_path true;
|
||||
let target = extract_output !output_name in
|
||||
Asmlibrarian.create_archive (List.rev !objfiles) target;
|
||||
Asmlibrarian.create_archive (get_objfiles ()) target;
|
||||
Warnings.check_fatal ();
|
||||
end
|
||||
else if !make_package then begin
|
||||
Compmisc.init_path true;
|
||||
let target = extract_output !output_name in
|
||||
Asmpackager.package_files ppf (List.rev !objfiles) target;
|
||||
Asmpackager.package_files ppf (get_objfiles ()) target;
|
||||
Warnings.check_fatal ();
|
||||
end
|
||||
else if !shared then begin
|
||||
Compmisc.init_path true;
|
||||
let target = extract_output !output_name in
|
||||
Asmlink.link_shared ppf (List.rev !objfiles) target;
|
||||
Asmlink.link_shared ppf (get_objfiles ()) target;
|
||||
Warnings.check_fatal ();
|
||||
end
|
||||
else if not !compile_only && !objfiles <> [] then begin
|
||||
|
@ -196,7 +196,7 @@ let main () =
|
|||
default_output !output_name
|
||||
in
|
||||
Compmisc.init_path true;
|
||||
Asmlink.link ppf (List.rev !objfiles) target;
|
||||
Asmlink.link ppf (get_objfiles ()) target;
|
||||
Warnings.check_fatal ();
|
||||
end;
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue