]> git.tdb.fi Git - builder.git/blobdiff - source/target.h
Consolidate various target state variables into a single state
[builder.git] / source / target.h
index 2c14ea1ae3064ef394e0bcff951dafddf8360b61..04c3c09a3648876578e8b7e7794e64bb3e9b6bd5 100644 (file)
@@ -24,22 +24,27 @@ public:
        typedef std::list<Target *> Dependencies;
 
 protected:
+       enum State
+       {
+               INIT,
+               PREPARING,
+               REBUILD,
+               BUILDING,
+               UPTODATE
+       };
+
        Builder &builder;
        const Package *package;
        std::string name;
 
        const Tool *tool;
-       bool building;
-       bool rebuild;
+       State state;
        std::string rebuild_reason;
        std::string install_location;
 
        Dependencies depends;
        bool deps_ready;
 
-       bool preparing;
-       bool prepared;
-
        Target(Builder &, const Package *, const std::string &);
 public:
        virtual ~Target() { }
@@ -67,7 +72,7 @@ public:
        const Tool *get_tool() const { return tool; }
 
        bool is_buildable() const { return tool!=0; }
-       bool needs_rebuild() const { return rebuild; }
+       bool needs_rebuild() const { return state>PREPARING && state<UPTODATE; }
        const std::string &get_rebuild_reason() const { return rebuild_reason; }
        bool is_installable() const { return !install_location.empty(); }
        const std::string &get_install_location() const { return install_location; }