diff options
author | Ken Martin <ken.martin@kitware.com> | 2001-05-04 13:39:05 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2001-05-04 13:39:05 (GMT) |
commit | 4d9b2f59cc4da52e93b6a5d647dba06828d258f3 (patch) | |
tree | 7552b7efe08da399577a5fc3846ac13635bd81b2 /Source/cmDSPWriter.cxx | |
parent | faaadc4a08e8103e25346a437fc203e05b43566c (diff) | |
download | CMake-4d9b2f59cc4da52e93b6a5d647dba06828d258f3.zip CMake-4d9b2f59cc4da52e93b6a5d647dba06828d258f3.tar.gz CMake-4d9b2f59cc4da52e93b6a5d647dba06828d258f3.tar.bz2 |
better custom rules
Diffstat (limited to 'Source/cmDSPWriter.cxx')
-rw-r--r-- | Source/cmDSPWriter.cxx | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx index 78bcb9e..56fb420 100644 --- a/Source/cmDSPWriter.cxx +++ b/Source/cmDSPWriter.cxx @@ -271,28 +271,32 @@ void cmDSPMakefile::WriteDSPFile(std::ostream& fout, // Loop through every custom command generating code from the // current source. + // build up the depends and outputs and commands + cmSourceGroup::CommandFiles totalCommand; + std::string totalCommandStr; for(cmSourceGroup::Commands::const_iterator c = commands.begin(); c != commands.end(); ++c) { - std::string command = c->first; - const cmSourceGroup::CommandFiles& commandFiles = c->second; - this->WriteCustomRule(fout, source.c_str(), command.c_str(), commandFiles.m_Depends, - commandFiles.m_Outputs); - // Create a dummy file with the name of the source if it does - // not exist - if(commandFiles.m_Outputs.size() == 0) - { - std::string dummyFile = m_Makefile->GetStartOutputDirectory(); - dummyFile += "/"; - dummyFile += source; - if(!cmSystemTools::FileExists(dummyFile.c_str())) - { - std::ofstream fout(dummyFile.c_str()); - fout << "Dummy file created by cmake as unused source for utility command.\n"; - } - } + totalCommandStr += "\n\t"; + totalCommandStr += c->first; + totalCommand.Merge(c->second); } - + // Create a dummy file with the name of the source if it does + // not exist + if(totalCommand.m_Outputs.empty()) + { + std::string dummyFile = m_Makefile->GetStartOutputDirectory(); + dummyFile += "/"; + dummyFile += source; + if(!cmSystemTools::FileExists(dummyFile.c_str())) + { + std::ofstream fout(dummyFile.c_str()); + fout << "Dummy file created by cmake as unused source for utility command.\n"; + } + } + this->WriteCustomRule(fout, source.c_str(), totalCommandStr.c_str(), + totalCommand.m_Depends, + totalCommand.m_Outputs); fout << "# End Source File\n"; } @@ -341,7 +345,7 @@ void cmDSPMakefile::WriteCustomRule(std::ostream& fout, if(outputs.size() == 0) { fout << source << "_force : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\""; - fout << "\n " << command << "\n\n"; + fout << command << "\n\n"; } // Write a rule for every output generated by this command. @@ -356,7 +360,7 @@ void cmDSPMakefile::WriteCustomRule(std::ostream& fout, { fout << " \"" << d->c_str() << "\""; } - fout << "\n " << command << "\n\n"; + fout << command << "\n\n"; } fout << "# End Custom Build\n\n"; |