- Hashtbl.add cachet tgt (F.mtime_of_target_object tgt);
- Hashtbl.add cached file (file, d, r, tgt);
- (file, d, r, tgt)
+ (* if a read only target exists, we use that one, otherwise
+ we use the writeable one that may be compiled *)
+ let _,_,_, tgt as tuple =
+ match F.mtime_of_target_object rotgt with
+ | Some _ as mtime ->
+ Hashtbl.add cachet rotgt mtime;
+ (file, d, r, rotgt)
+ | None ->
+ Hashtbl.add cachet wtgt (F.mtime_of_target_object wtgt);
+ (file, d, r, wtgt)
+ in
+ Hashtbl.add cached file tuple;
+ tuple