]> git.tdb.fi Git - builder.git/blobdiff - source/target.cpp
Make tools capable of reporting a system-wide path used to locate input files
[builder.git] / source / target.cpp
index 7c6141df7403b1978ccd32f8fdfa6ce911c10f74..297ae3f4211b9a4b3be3b2f68e1fd2ab43dc2ec5 100644 (file)
 using namespace std;
 using namespace Msp;
 
-Target::Target(Builder &b, const Package *p, const string &n):
+Target::Target(Builder &b, const string &n):
        builder(b),
-       package(p),
+       package(0),
+       component(0),
        name(n),
        tool(0),
-       state(INIT),
-       deps_ready(false)
+       state(INIT)
 {
        builder.add_target(this);
 }
@@ -65,6 +65,8 @@ void Target::prepare()
        }
 
        state = PREPARING;
+       find_depends();
+
        for(Dependencies::iterator i=depends.begin(); i!=depends.end(); ++i)
                (*i)->prepare();
 
@@ -95,6 +97,9 @@ Task *Target::build()
 
 void Target::mark_rebuild(const std::string &reason)
 {
+       if(reason.empty())
+               throw invalid_argument("No reason given for rebuilding "+name);
+
        state = REBUILD;
        rebuild_reason = reason;
 }