FileTarget::FileTarget(Builder &b, const Package *p, const FS::Path &a):
// XXX Builder depends on target name being its path for locating file targets
Target(b, p, /*FS::basename*/(a.str())),
- path(a)
+ path(a),
+ size(0)
{
struct stat st;
if(!FS::stat(path, st))
+ {
mtime=Time::TimeStamp::from_unixtime(st.st_mtime);
+ size=st.st_size;
+ }
}
{
protected:
Msp::FS::Path path;
+ unsigned size;
FileTarget(Builder &, const Package *, const Msp::FS::Path &);
public:
const Msp::FS::Path &get_path() const { return path; }
+ unsigned get_size() const { return size; }
};
#endif
{
if(!mtime)
mark_rebuild("Does not exist");
- else if(source.get_mtime()>mtime)
+ else if(source.get_mtime()>mtime || source.get_size()!=size)
mark_rebuild(FS::basename(source.get_name())+" has changed");
else if(source.get_rebuild())
mark_rebuild(FS::basename(source.get_name())+" needs rebuilding");