BUG: Fixed output of dependencies. It needs to loop over the makefile's targets, not the source lists.

This commit is contained in:
Brad King 2001-04-25 09:39:23 -04:00
parent ddbf1feab4
commit c3ab706698
1 changed files with 16 additions and 20 deletions

View File

@ -214,7 +214,6 @@ void cmUnixMakefileGenerator::OutputDependencies(std::ostream& fout)
{ {
fout << "CMAKE_DEPEND_LIBS = "; fout << "CMAKE_DEPEND_LIBS = ";
std::vector<std::string>& libs = m_Makefile->GetLinkLibraries(); std::vector<std::string>& libs = m_Makefile->GetLinkLibraries();
std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories();
std::vector<std::string>::iterator dir, lib; std::vector<std::string>::iterator dir, lib;
// Search the list of libraries that will be linked into // Search the list of libraries that will be linked into
// the executable // the executable
@ -384,30 +383,27 @@ void cmUnixMakefileGenerator::OutputSubDirectoryRules(std::ostream& fout)
// by the class cmMakeDepend GenerateMakefile // by the class cmMakeDepend GenerateMakefile
void cmUnixMakefileGenerator::OutputObjectDepends(std::ostream& fout) void cmUnixMakefileGenerator::OutputObjectDepends(std::ostream& fout)
{ {
cmMakefile::SourceMap &Sources = m_Makefile->GetSources(); // Iterate over every target.
for(cmMakefile::SourceMap::iterator l = Sources.begin(); std::map<std::string, cmTarget>& targets = m_Makefile->GetTargets();
l != Sources.end(); l++) for(std::map<std::string, cmTarget>::const_iterator target = targets.begin();
target != targets.end(); ++target)
{ {
for(std::vector<cmSourceFile>::iterator i = l->second.begin(); // Iterate over every source for this target.
i != l->second.end(); i++) const std::vector<cmSourceFile>& sources = target->second.GetSourceFiles();
for(std::vector<cmSourceFile>::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"; fout << source->GetSourceName() << ".o :";
for(std::vector<std::string>::iterator j = // Iterate through all the dependencies for this source.
i->GetDepends().begin(); for(std::vector<std::string>::const_iterator dep =
j != i->GetDepends().end(); ++j) source->GetDepends().begin();
dep != source->GetDepends().end(); ++dep)
{ {
if(j+1 == i->GetDepends().end()) fout << " \\\n" << dep->c_str();
{
fout << *j << " \n";
}
else
{
fout << *j << " \\\n";
}
} }
fout << "\n\n"; fout << "\n\n";
} }