- let is_built opts t tgt =
- younger_s_t opts t tgt
- ;;
-
- let assoc4 l k = List.find (fun (k1,_,_,_) -> k1 = k) l;;
-
- let fst4 = function (x,_,_,_) -> x;;
-
- let rec needs_build opts deps compiled (t,dependencies,root,tgt) =
- say ("Checking if "^F.string_of_source_object t^ " needs to be built");
- if List.mem t compiled then
- (say "already compiled"; false)
- else
- if not (is_built opts t tgt) then
- (say(F.string_of_source_object t^" is not built, thus needs to be built");
- true)
- else
- try
- let unsat =
- List.find
- (needs_build opts deps compiled)
- (List.map (assoc4 deps) dependencies)
- in
- say (F.string_of_source_object t^" depends on "^
- F.string_of_source_object (fst4 unsat)^
- " that needs to be built, thus needs to be built");
- true
- with Not_found ->
- try
- let _,_,_,unsat =
- List.find
- (fun (_,_,_,tgt1) -> younger_t_t opts tgt tgt1)
- (List.map (assoc4 deps) dependencies)
- in
- say
- (F.string_of_source_object t^" depends on "^F.string_of_target_object
- unsat^" and "^F.string_of_source_object t^".o is younger than "^
- F.string_of_target_object unsat^", thus needs to be built");
- true
- with Not_found -> false
- ;;
-
- let is_buildable opts compiled deps (t,dependencies,root,tgt as what) =
- say ("Checking if "^F.string_of_source_object t^" is buildable");
- let b = needs_build opts deps compiled what in
- if not b then
- (say (F.string_of_source_object t^
- " does not need to be built, thus it not buildable");
- false)
- else
- try
- let unsat,_,_,_ =
- List.find (needs_build opts deps compiled)
- (List.map (assoc4 deps) dependencies)
- in
- say (F.string_of_source_object t^" depends on "^
- F.string_of_source_object unsat^
- " that needs build, thus is not buildable");
- false
- with Not_found ->
- say
- ("None of "^F.string_of_source_object t^
- " dependencies needs to be built, thus it is buildable");
- true
- ;;
-