11 Manages a graph of targets.
16 typedef std::map<std::string, Target *> TargetMap;
24 BuildGraph(Builder &);
27 /** Looks up a target by name. Returns 0 if no such target exists. */
28 Target *get_target(const std::string &) const;
30 const TargetMap &get_targets() const { return targets; }
32 /** Adds a target. It can later be retrieved by name. Called from Target
34 void add_target(Target *);
36 /** Adds a target that is a primary build goal. Such targets will be added
37 as dependencies of the "world" virtual target. If the target belongs to a
38 default component of the main package, it's also added to the "default"
40 void add_primary_target(Target &);
42 /** Adds a target that will be installed. A new InstalledFile target is
43 created and added as a dependency to the "install" virtual target. */
44 void add_installed_target(Target &);
46 /** Adds a target as a toplevel goal. These are stored as dependencies of
47 the "goals" virtual target. */
48 void add_goal(Target &);
50 Target &get_goals() const { return *goals; }
52 /** Prepares all toplevel goals for building. If no goals are defined, the
53 "default" target is added as a goal. */
56 /** Marks all buildable targets to be rebuilt. The graph must be prepared
58 void force_full_rebuild();
60 /** Returns the number of targets that are going to be rebuilt. The graph
61 must be prepared first. */
62 unsigned count_rebuild_targets() const;
64 /** Returns a target that can be built and is needed for building the goal
66 Target *get_buildable_target() const;