- counted=true;
- unsigned count=rebuild;
- for(list<Target *>::iterator i=depends.begin(); i!=depends.end(); ++i)
- count+=(*i)->count_rebuild();
- return count;
-}
-
-void Target::touch()
-{
- mtime=Time::now();
-}
-
-Target::Target(Builder &b, const Package *p, const string &n):
- builder(b),
- package(p),
- name(n),
- building(false),
- rebuild(false),
- deps_ready(false),
- prepared(false),
- buildable(false),
- counted(false)
-{
- struct stat st;
- if(!Path::stat(name, st))
- mtime=Time::TimeStamp::from_unixtime(st.st_mtime);
-}
-
-void Target::mark_rebuild(const std::string &reason)
-{
- rebuild=true;
- rebuild_reason=reason;
-}
-
-void Target::check_rebuild()
-{
- if(!buildable)
- return;
+ // XXX Minor breach of OO here
+ if(FileTarget *ft = dynamic_cast<FileTarget *>(this))
+ if(!builder.get_dry_run() && FS::exists(ft->get_path()))
+ FS::unlink(ft->get_path());