-/**
-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 Package *p, const string &n):
+ builder(b),
+ package(p),
+ name(n),
+ buildable(false),
+ building(false),
+ rebuild(false),
+ deps_ready(false),
+ prepared(false),
+ counted(false)
+{
+ builder.add_target(this);
+
+ struct stat st;
+ if(!FS::stat(name, st))
+ mtime=Time::TimeStamp::from_unixtime(st.st_mtime);
+}
+