]> git.tdb.fi Git - builder.git/blobdiff - source/buildgraph.h
Add gcc's private library directory to ClangLinker's system path
[builder.git] / source / buildgraph.h
index 54409c0c061c648c8bb2c5e9c44f9ba6f201425d..371b5447e2e01291f8e902103a34d3cb12065565 100644 (file)
@@ -1,7 +1,8 @@
 #ifndef BUILDGRAPH_H_
 #define BUILDGRAPH_H_
 
-#include "virtualfilesystem.h"
+#include <map>
+#include <string>
 
 class Builder;
 class Target;
@@ -11,12 +12,10 @@ Manages a graph of targets.
 */
 class BuildGraph
 {
-public:
-       typedef std::map<std::string, Target *> TargetMap;
-
 private:
        Builder &builder;
-       TargetMap targets;
+       std::map<std::string, Target *> targets;
+       Target *goals;
 
 public:
        BuildGraph(Builder &);
@@ -25,7 +24,7 @@ public:
        /** Looks up a target by name.  Returns 0 if no such target exists. */
        Target *get_target(const std::string &) const;
 
-       const TargetMap &get_targets() const { return targets; }
+       const std::map<std::string, Target *> &get_targets() const { return targets; }
 
        /** Adds a target.  It can later be retrieved by name.  Called from Target
        constructor. */
@@ -40,6 +39,28 @@ public:
        /** Adds a target that will be installed.  A new InstalledFile target is
        created and added as a dependency to the "install" virtual target. */
        void add_installed_target(Target &);
+
+       /** Adds a target as a toplevel goal.  These are stored as dependencies of
+       the "goals" virtual target. */
+       void add_goal(Target &);
+
+       Target &get_goals() const { return *goals; }
+
+       /** Prepares all toplevel goals for building.  If no goals are defined, the
+       "default" target is added as a goal. */
+       void prepare();
+
+       /** Marks all buildable targets to be rebuilt.  The graph must be prepared
+       first. */
+       void force_full_rebuild();
+
+       /** Returns the number of targets that are going to be rebuilt.  The graph
+       must be prepared first. */
+       unsigned count_rebuild_targets() const;
+
+       /** Returns a target that can be built and is needed for building the goal
+       targets.  Null */
+       Target *get_buildable_target() const;
 };
 
 #endif