1 #include <msp/path/utils.h>
9 Target *Target::get_buildable_target()
12 for(list<Target *>::iterator i=depends.begin(); i!=depends.end(); ++i)
14 Target *tgt=(*i)->get_buildable_target();
17 else if((*i)->get_rebuild())
21 if(self_ok && rebuild && !building)
27 void Target::add_depend(Target *dep)
29 depends.push_back(dep);
30 dep->rdepends.push_back(this);
33 void Target::prepare()
38 for(list<Target *>::iterator i=depends.begin(); i!=depends.end(); ++i)
44 Target::Target(Builder &b, const Package *p, const string &n):
54 if(!Path::stat(name, st))
56 mtime=Time::TimeStamp::from_unixtime(st.st_mtime);
61 void Target::mark_rebuild(const std::string &reason)
64 rebuild_reason=reason;
67 void Target::check_rebuild()
73 mark_rebuild("Does not exist");
76 for(list<Target *>::iterator i=depends.begin(); (i!=depends.end() && !rebuild); ++i)
78 if((*i)->get_virtual_mtime()>mtime)
79 mark_rebuild((*i)->get_name()+" has changed");
80 else if((*i)->get_rebuild())
81 mark_rebuild((*i)->get_name()+" needs rebuilding");
86 Action *Target::build(Action *action)
89 action->signal_done.connect(sigc::mem_fun(this, &Target::build_done));
93 void Target::build_done()