X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fanalyzer.cpp;h=d59519c13115c186d52fc230353690c08372bd62;hb=463a3521e27870294455373f9c69279069611975;hp=75c08849b39c61fdb222bbdcae8ab981bedfb770;hpb=e7fe6a0e161cbba80ef924f53792eded80cbb3a1;p=builder.git diff --git a/source/analyzer.cpp b/source/analyzer.cpp index 75c0884..d59519c 100644 --- a/source/analyzer.cpp +++ b/source/analyzer.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of builder -Copyright © 2006-2009 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include #include #include "analyzer.h" @@ -30,8 +23,8 @@ void Analyzer::analyze() if(mode==RDEPS) { rdepends.clear(); - const TargetMap &targets = builder.get_targets(); - for(TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i) + const Builder::TargetMap &targets = builder.get_targets(); + for(Builder::TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i) { const TargetList &depends = i->second->get_depends(); for(TargetList::const_iterator j=depends.begin(); j!=depends.end(); ++j) @@ -48,7 +41,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 +54,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(&tgt)) return build_depend_table(obj->get_source(), depth); - else if(const Install *inst = dynamic_cast(&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;