- struct stat st;
- if(!FS::stat(path, st))
- mtime=Time::TimeStamp::from_unixtime(st.st_mtime);
+ mtime = Time::now();
+}
+
+void FileTarget::check_rebuild()
+{
+ if(!buildable)
+ return;
+
+ if(builder.get_build_all())
+ mark_rebuild("Rebuilding everything");
+ else if(!mtime)
+ mark_rebuild("Does not exist");
+ else
+ {
+ for(TargetList::iterator i=depends.begin(); (i!=depends.end() && !rebuild); ++i)
+ {
+ FileTarget *ft = dynamic_cast<FileTarget *>(*i);
+ if(ft && ft->get_mtime()>mtime)
+ mark_rebuild((*i)->get_name()+" has changed");
+ else if((*i)->get_rebuild())
+ mark_rebuild((*i)->get_name()+" needs rebuilding");
+ else
+ {
+ Target *real = ft->get_real_target();
+ if(real->get_rebuild())
+ mark_rebuild(real->get_name()+" needs rebuilding");
+ }
+ }
+ }
+
+ const SourcePackage *spkg = dynamic_cast<const SourcePackage *>(package);
+ if(!rebuild && spkg && spkg->get_config().get_mtime()>mtime)
+ mark_rebuild("Package options changed");