]> git.tdb.fi Git - builder.git/blobdiff - source/filetarget.cpp
Fix rebuild graph walking over symlinks
[builder.git] / source / filetarget.cpp
index e7cfc6c10ce638fcd643a3158ab7d4fcff3eb72e..061a3ae20968750a70a589d21618059cb150c913 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of builder
-Copyright © 2009  Mikko Rasa, Mikkosoft Productions
+Copyright © 2009-2010  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
@@ -23,7 +23,7 @@ FileTarget::FileTarget(Builder &b, const Package *p, const FS::Path &a):
        builder.add_target(this);
 
        struct stat st;
-       if(!FS::stat(path, st))
+       if(!FS::lstat(path, st))
        {
                mtime = Time::TimeStamp::from_unixtime(st.st_mtime);
                size = st.st_size;
@@ -53,6 +53,12 @@ void FileTarget::check_rebuild()
                                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");
+                       }
                }
        }