make (compiled@List.map fst todo) deps)
;;
- let make deps = make [] deps
+ let rec purge_unwanted_roots wanted deps =
+ let roots, rest =
+ List.partition
+ (fun (t,d) ->
+ not (List.exists (fun (_,d1) -> List.mem t d1) deps))
+ deps
+ in
+ let newroots = List.filter (fun (t,_) -> List.mem t wanted) roots in
+ if newroots = roots then
+ deps
+ else
+ purge_unwanted_roots wanted (newroots @ rest)
+ ;;
+
+ let make deps targets =
+ if targets = [] then
+ make [] deps
+ else
+ make [] (purge_unwanted_roots targets deps)
+ ;;
end
module Make :
functor (F : Format) ->
sig
- val make : (F.source_object * F.source_object list) list -> unit
+ (* make [deps] [targets], targets = [] means make all *)
+ val make : (F.source_object * F.source_object list) list ->
+ F.source_object list -> unit
end