Pass obj_dir explicitely to Exe.build_and_link and don't return it
The only place where we used the default value was gen_rules
This commit is contained in:
parent
138c920069
commit
4dc8d2456f
18
src/exe.ml
18
src/exe.ml
|
@ -112,7 +112,7 @@ let link_exe
|
|||
SC.add_rules sctx (List.map rules ~f:(fun r -> libs_and_cm_and_flags >>> r))
|
||||
|
||||
let build_and_link_many
|
||||
?obj_dir ~dir ~programs ~modules
|
||||
~dir ~obj_dir ~programs ~modules
|
||||
~scope
|
||||
~linkages
|
||||
?(requires=Build.return [])
|
||||
|
@ -122,14 +122,6 @@ let build_and_link_many
|
|||
?(js_of_ocaml=Jbuild.Js_of_ocaml.default)
|
||||
sctx
|
||||
=
|
||||
let item = (List.hd programs).Program.name in
|
||||
let obj_dir =
|
||||
match obj_dir with
|
||||
(* Use "eobjs" rather than "objs" to avoid a potential conflict with a
|
||||
library of the same name *)
|
||||
| None -> Path.relative dir ("." ^ item ^ ".eobjs")
|
||||
| Some d -> d
|
||||
in
|
||||
let modules =
|
||||
String_map.map modules ~f:(Module.set_obj_name ~wrapper:None)
|
||||
in
|
||||
|
@ -162,9 +154,7 @@ let build_and_link_many
|
|||
~top_sorted_modules
|
||||
~js_of_ocaml
|
||||
~flags
|
||||
?link_flags));
|
||||
?link_flags))
|
||||
|
||||
obj_dir
|
||||
|
||||
let build_and_link ?obj_dir ~dir ~program =
|
||||
build_and_link_many ?obj_dir ~dir ~programs:[program]
|
||||
let build_and_link ~dir ~obj_dir ~program =
|
||||
build_and_link_many ~dir ~obj_dir ~programs:[program]
|
||||
|
|
14
src/exe.mli
14
src/exe.mli
|
@ -34,11 +34,11 @@ end
|
|||
|
||||
(** {1 High-level functions} *)
|
||||
|
||||
(** Build and link one or more executables. Return the object directory. *)
|
||||
(** Build and link one or more executables *)
|
||||
|
||||
val build_and_link
|
||||
: ?obj_dir:Path.t
|
||||
-> dir:Path.t
|
||||
: dir:Path.t
|
||||
-> obj_dir:Path.t
|
||||
-> program:Program.t
|
||||
-> modules:Module.t String_map.t
|
||||
-> scope:Scope.t
|
||||
|
@ -49,11 +49,11 @@ val build_and_link
|
|||
-> ?link_flags:(unit, string list) Build.t
|
||||
-> ?js_of_ocaml:Jbuild.Js_of_ocaml.t
|
||||
-> Super_context.t
|
||||
-> Path.t
|
||||
-> unit
|
||||
|
||||
val build_and_link_many
|
||||
: ?obj_dir:Path.t
|
||||
-> dir:Path.t
|
||||
: dir:Path.t
|
||||
-> obj_dir:Path.t
|
||||
-> programs:Program.t list
|
||||
-> modules:Module.t String_map.t
|
||||
-> scope:Scope.t
|
||||
|
@ -64,7 +64,7 @@ val build_and_link_many
|
|||
-> ?link_flags:(unit, string list) Build.t
|
||||
-> ?js_of_ocaml:Jbuild.Js_of_ocaml.t
|
||||
-> Super_context.t
|
||||
-> Path.t
|
||||
-> unit
|
||||
|
||||
(** {1 Low-level functions} *)
|
||||
|
||||
|
|
|
@ -813,9 +813,14 @@ module Gen(P : Params) = struct
|
|||
compile_info
|
||||
in
|
||||
|
||||
(* Use "eobjs" rather than "objs" to avoid a potential conflict
|
||||
with a library of the same name *)
|
||||
let obj_dir =
|
||||
Path.relative dir ("." ^ (List.hd programs).name ^ ".eobjs")
|
||||
in
|
||||
Exe.build_and_link_many sctx
|
||||
~dir
|
||||
~obj_dir
|
||||
~programs
|
||||
~modules
|
||||
~already_used
|
||||
|
@ -824,8 +829,7 @@ module Gen(P : Params) = struct
|
|||
~requires
|
||||
~flags
|
||||
~link_flags
|
||||
~js_of_ocaml:exes.buildable.js_of_ocaml
|
||||
in
|
||||
~js_of_ocaml:exes.buildable.js_of_ocaml;
|
||||
|
||||
{ Merlin.
|
||||
requires = real_requires
|
||||
|
|
|
@ -68,7 +68,6 @@ let setup sctx ~dir ~(libs : Library.t list) ~scope =
|
|||
|> Lib.Compile.make
|
||||
|> Super_context.Libs.requires sctx ~dir ~has_dot_merlin:false
|
||||
in
|
||||
let (_obj_dir : Path.t) =
|
||||
Exe.build_and_link sctx
|
||||
~dir:utop_exe_dir
|
||||
~obj_dir:utop_exe_dir
|
||||
|
@ -78,6 +77,5 @@ let setup sctx ~dir ~(libs : Library.t list) ~scope =
|
|||
~linkages:[Exe.Linkage.custom]
|
||||
~requires
|
||||
~flags:(Ocaml_flags.append_common (Ocaml_flags.default ()) ["-w"; "-24"])
|
||||
~link_flags:(Build.return ["-linkall"; "-warn-error"; "-31"])
|
||||
in
|
||||
~link_flags:(Build.return ["-linkall"; "-warn-error"; "-31"]);
|
||||
add_module_rules sctx ~dir:utop_exe_dir requires
|
||||
|
|
Loading…
Reference in New Issue