X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ffiletarget.cpp;h=51a92d13b1a11f61c34671a1d8c39adfa710bdcc;hb=HEAD;hp=e7cfc6c10ce638fcd643a3158ab7d4fcff3eb72e;hpb=20994a6f4802f2dbcf01888d0e1996edf554ade5;p=builder.git diff --git a/source/filetarget.cpp b/source/filetarget.cpp deleted file mode 100644 index e7cfc6c..0000000 --- a/source/filetarget.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* $Id$ - -This file is part of builder -Copyright © 2009 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - -#include -#include -#include -#include "builder.h" -#include "filetarget.h" -#include "sourcepackage.h" - -using namespace std; -using namespace Msp; - -FileTarget::FileTarget(Builder &b, const Package *p, const FS::Path &a): - Target(b, p, FS::basename(a.str())), - path(a), - size(0) -{ - builder.add_target(this); - - struct stat st; - if(!FS::stat(path, st)) - { - mtime = Time::TimeStamp::from_unixtime(st.st_mtime); - size = st.st_size; - } -} - -void FileTarget::touch() -{ - 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(*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"); - } - } - - const SourcePackage *spkg = dynamic_cast(package); - if(!rebuild && spkg && spkg->get_config().get_mtime()>mtime) - mark_rebuild("Package options changed"); -}