-/**
-Tries to locate a target that will help getting this target built. If all
-dependencies are up-to-date, returns this target. If there are no targets
-ready to be built (maybe because they are being built right now), returns 0.
-*/
+Target::Target(Builder &b, const string &n):
+ builder(b),
+ package(0),
+ component(0),
+ name(n),
+ tool(0),
+ state(INIT)
+{
+ builder.add_target(this);
+}
+
+void Target::add_dependency(Target &dep)
+{
+ if(&dep==this)
+ throw invalid_argument("Target::add_depend");
+ depends.push_back(&dep);
+ if(state>PREPARING)
+ dep.signal_bubble_rebuild.connect(sigc::mem_fun(this, &Target::check_rebuild));
+}
+