Ensure executables depend on object files

Previously, in Mode.Native, executables depended on .cmx files only.
This was fine when changes were detected by timestamp, but it is
possible to semantically alter an .ml such that only the .o/.obj file
alters. In this situation, Jbuilder would rebuild the .cmx file, but not
relink the executable.

Fixes #237.

Signed-off-by: David Allsopp <david.allsopp@metastack.com>
This commit is contained in:
David Allsopp 2017-08-26 14:01:20 +01:00
parent 9180f88dc3
commit 77c79ebff8
1 changed files with 7 additions and 1 deletions

View File

@ -440,8 +440,14 @@ module Gen(P : Params) = struct
~mode
[String.capitalize_ascii name]))
in
let objs (_, cm) =
if mode = Mode.Byte then
[]
else
List.map ~f:(Path.change_extension ~ext:ctx.ext_obj) cm
in
SC.add_rule sctx
(libs_and_cm
((libs_and_cm >>> Build.dyn_paths (Build.arr objs))
&&&
Build.fanout
(Ocaml_flags.get flags mode)