diff options
Diffstat (limited to 'Source/cmUnixMakefileGenerator.cxx')
-rw-r--r-- | Source/cmUnixMakefileGenerator.cxx | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index 955b108..0128848 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -394,21 +394,57 @@ void cmUnixMakefileGenerator::OutputObjectDepends(std::ostream& fout) // Output each custom rule in the following format: -// m_Result: m_Source m_Depends[0] m_Depends[1] ... -// (tab) m_Command +// output: source depends... +// (tab) command... void cmUnixMakefileGenerator::OutputCustomRules(std::ostream& fout) { - for(std::vector<cmMakefile::customCommand>::const_iterator c = - m_Makefile->GetCustomCommands().begin(); - c != m_Makefile->GetCustomCommands().end(); ++c) + // Loop through every source group. + for(std::vector<cmSourceGroup>::const_iterator sg = + m_Makefile->GetSourceGroups().begin(); + sg != m_Makefile->GetSourceGroups().end(); ++sg) { - fout << c->m_Result.c_str() << ": " << c->m_Source.c_str(); - for(std::vector<std::string>::const_iterator d = c->m_Depends.begin(); - d != c->m_Depends.end(); ++ d) + const cmSourceGroup::CustomCommands& customCommands = sg->GetCustomCommands(); + if(customCommands.empty()) + { continue; } + + std::string name = sg->GetName(); + if(name != "") { - fout << " " << d->c_str(); + fout << "# Start of source group \"" << name.c_str() << "\"\n"; } - fout << "\n\t" << c->m_Command.c_str() << "\n\n"; - } - + + // Loop through each source in the source group. + for(cmSourceGroup::CustomCommands::const_iterator cc = + customCommands.begin(); cc != customCommands.end(); ++ cc) + { + std::string source = cc->first; + const cmSourceGroup::Commands& commands = cc->second; + // Loop through every command generating code from the current source. + for(cmSourceGroup::Commands::const_iterator c = commands.begin(); + c != commands.end(); ++c) + { + std::string command = c->first; + const cmSourceGroup::CommandFiles& commandFiles = c->second; + // Write a rule for every output generated by this command. + for(std::set<std::string>::const_iterator output = + commandFiles.m_Outputs.begin(); + output != commandFiles.m_Outputs.end(); ++output) + { + fout << output->c_str() << ": " << source.c_str(); + // Write out all the dependencies for this rule. + for(std::set<std::string>::const_iterator d = + commandFiles.m_Depends.begin(); + d != commandFiles.m_Depends.end(); ++d) + { + fout << " " << d->c_str(); + } + fout << "\n\t" << command.c_str() << "\n\n"; + } + } + } + if(name != "") + { + fout << "# End of source group \"" << name.c_str() << "\"\n\n"; + } + } } |