1 #include <msp/path/utils.h>
10 Target *Target::get_buildable_target()
13 for(list<Target *>::iterator i=depends.begin(); i!=depends.end(); ++i)
15 Target *tgt=(*i)->get_buildable_target();
18 else if((*i)->get_rebuild())
22 if(self_ok && rebuild && !building)
28 void Target::add_depend(Target *dep)
30 depends.push_back(dep);
31 dep->rdepends.push_back(this);
34 void Target::prepare()
39 for(list<Target *>::iterator i=depends.begin(); i!=depends.end(); ++i)
45 Target::Target(Builder &b, const Package *p, const string &n):
55 if(!Path::stat(name, st))
57 mtime=Time::TimeStamp::from_unixtime(st.st_mtime);
62 void Target::mark_rebuild(const std::string &reason)
65 rebuild_reason=reason;
68 void Target::check_rebuild()
74 mark_rebuild("Does not exist");
77 for(list<Target *>::iterator i=depends.begin(); (i!=depends.end() && !rebuild); ++i)
79 if((*i)->get_virtual_mtime()>mtime)
80 mark_rebuild((*i)->get_name()+" has changed");
81 else if((*i)->get_rebuild())
82 mark_rebuild((*i)->get_name()+" needs rebuilding");
85 if(!rebuild && package && package->get_config().get_mtime()>mtime)
86 mark_rebuild("Package options changed");
89 Action *Target::build(Action *action)
92 action->signal_done.connect(sigc::mem_fun(this, &Target::build_done));
96 void Target::build_done()