summaryrefslogtreecommitdiffstats
path: root/Source/cmUnixMakefileGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2001-03-20 18:20:59 (GMT)
committerBrad King <brad.king@kitware.com>2001-03-20 18:20:59 (GMT)
commit8c087d0e7a2045fead07d3069eefddfa4c515179 (patch)
tree3ea3acebf9283f281e5753a15968bd13c8558da2 /Source/cmUnixMakefileGenerator.cxx
parent51ef865ef8c3b39e08ad627cb0effa35ca74955a (diff)
downloadCMake-8c087d0e7a2045fead07d3069eefddfa4c515179.zip
CMake-8c087d0e7a2045fead07d3069eefddfa4c515179.tar.gz
CMake-8c087d0e7a2045fead07d3069eefddfa4c515179.tar.bz2
ENH: Added SOURCE_GROUP command and corresponding support code. This command allows CMakeLists files to specify how sources are organized into groups in the generated DSP files and makefiles.
Diffstat (limited to 'Source/cmUnixMakefileGenerator.cxx')
-rw-r--r--Source/cmUnixMakefileGenerator.cxx60
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";
+ }
+ }
}