]> git.tdb.fi Git - builder.git/blobdiff - source/analyzer.cpp
Fix rebuild graph walking over symlinks
[builder.git] / source / analyzer.cpp
index 75c08849b39c61fdb222bbdcae8ab981bedfb770..984af61be7167b9ad06e47abdd4838e3e4bbb521 100644 (file)
@@ -48,7 +48,7 @@ void Analyzer::analyze()
        row.push_back("Rebuild");
        table.push_back(row);
        
-       const Target &cmdline = *builder.get_target("cmdline");
+       Target &cmdline = *builder.get_target("cmdline");
        if(mode==RDEPS)
        {
                const TargetList &deps = cmdline.get_depends();
@@ -61,19 +61,20 @@ void Analyzer::analyze()
        print_table();
 }
 
-void Analyzer::build_depend_table(const Target &tgt, unsigned depth)
+void Analyzer::build_depend_table(Target &tgt, unsigned depth)
 {
+       Target *real = tgt.get_real_target();
        if(mode==DEPS)
        {
                // Skip trivial targets
+               if(real!=&tgt)
+                       return build_depend_table(*real, depth);
                if(const ObjectFile *obj = dynamic_cast<const ObjectFile *>(&tgt))
                        return build_depend_table(obj->get_source(), depth);
-               else if(const Install *inst = dynamic_cast<const Install *>(&tgt))
-                       return build_depend_table(inst->get_source(), depth);
        }
-       else if(mode==REBUILD && !tgt.get_rebuild())
+       else if(mode==REBUILD && !tgt.get_rebuild() && !real->get_rebuild())
                /* All targets that depend on to-be-built targets will be rebuilt
-               themselves, so we cn stop here. */
+               themselves, so we can stop here. */
                return;
        
        TableRow row;