From c3ab7066981037dcb96993c901ed970c39e5ad8b Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 25 Apr 2001 09:39:23 -0400 Subject: [PATCH] BUG: Fixed output of dependencies. It needs to loop over the makefile's targets, not the source lists. --- Source/cmUnixMakefileGenerator.cxx | 36 +++++++++++++----------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index a1e7dfef7..589e4b14d 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -214,7 +214,6 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout) { fout << "CMAKE_DEPEND_LIBS = "; std::vector& libs = m_Makefile->GetLinkLibraries(); - std::vector& libdirs = m_Makefile->GetLinkDirectories(); std::vector::iterator dir, lib; // Search the list of libraries that will be linked into // the executable @@ -384,30 +383,27 @@ void cmUnixMakefileGenerator::OutputSubDirectoryRules(std::ostream& fout) // by the class cmMakeDepend GenerateMakefile void cmUnixMakefileGenerator::OutputObjectDepends(std::ostream& fout) { - cmMakefile::SourceMap &Sources = m_Makefile->GetSources(); - for(cmMakefile::SourceMap::iterator l = Sources.begin(); - l != Sources.end(); l++) + // Iterate over every target. + std::map& targets = m_Makefile->GetTargets(); + for(std::map::const_iterator target = targets.begin(); + target != targets.end(); ++target) { - for(std::vector::iterator i = l->second.begin(); - i != l->second.end(); i++) + // Iterate over every source for this target. + const std::vector& sources = target->second.GetSourceFiles(); + for(std::vector::const_iterator source = sources.begin(); + source != sources.end(); ++source) { - if(!i->IsAHeaderFileOnly()) + if(!source->IsAHeaderFileOnly()) { - if(i->GetDepends().size()) + if(!source->GetDepends().empty()) { - fout << i->GetSourceName() << ".o : \\\n"; - for(std::vector::iterator j = - i->GetDepends().begin(); - j != i->GetDepends().end(); ++j) + fout << source->GetSourceName() << ".o :"; + // Iterate through all the dependencies for this source. + for(std::vector::const_iterator dep = + source->GetDepends().begin(); + dep != source->GetDepends().end(); ++dep) { - if(j+1 == i->GetDepends().end()) - { - fout << *j << " \n"; - } - else - { - fout << *j << " \\\n"; - } + fout << " \\\n" << dep->c_str(); } fout << "\n\n"; }