From e126954393c945b71c4bd243090076dc24c0ec7d Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Fri, 4 May 2001 17:00:22 -0400 Subject: fixes for untiltiy targets in all --- Source/cmMakefile.cxx | 2 ++ Source/cmUnixMakefileGenerator.cxx | 33 +++++++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9680064..d8dfe2f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -467,6 +467,7 @@ void cmMakefile::AddLibrary(const char* lname, const std::vector &s { cmTarget target; target.SetType(cmTarget::LIBRARY); + target.SetInAll(true); target.GetSourceLists() = srcs; m_Targets.insert(cmTargets::value_type(lname,target)); } @@ -476,6 +477,7 @@ void cmMakefile::AddExecutable(const char *exeName, { cmTarget target; target.SetType(cmTarget::EXECUTABLE); + target.SetInAll(true); target.GetSourceLists() = srcs; m_Targets.insert(cmTargets::value_type(exeName,target)); } diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index 4e1506a..be72113 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -95,11 +95,12 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout) // for each target add to the list of targets fout << "TARGETS = "; const cmTargets &tgts = m_Makefile->GetTargets(); - // libraries + // list libraries first for(cmTargets::const_iterator l = tgts.begin(); l != tgts.end(); l++) { - if (l->second.GetType() == cmTarget::LIBRARY) + if (l->second.GetType() == cmTarget::LIBRARY && + l->second.IsInAll()) { fout << " \\\nlib" << l->first.c_str() << "${CMAKE_LIB_EXT}"; } @@ -108,9 +109,20 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout) for(cmTargets::const_iterator l = tgts.begin(); l != tgts.end(); l++) { - if (!l->second.GetType() == cmTarget::LIBRARY) + if (l->second.GetType() == cmTarget::EXECUTABLE && + l->second.IsInAll()) + { + fout << " \\\n" << l->first.c_str(); + } + } + // list utilities last + for(cmTargets::const_iterator l = tgts.begin(); + l != tgts.end(); l++) + { + if (l->second.GetType() == cmTarget::UTILITY && + l->second.IsInAll()) { - fout << "\\\n" << l->first.c_str(); + fout << " \\\n" << l->first.c_str(); } } fout << "\n\n"; @@ -488,10 +500,19 @@ void cmUnixMakefileGenerator::OutputCustomRules(std::ostream& fout) std::string command = c->first; const cmSourceGroup::CommandFiles& commandFiles = c->second; // if the command has no outputs, then it is a utility command - // with no outputs or depends + // with no outputs if(commandFiles.m_Outputs.size() == 0) { - fout << source.c_str() << ":\n\t" << command.c_str() << "\n\n"; + fout << source.c_str() << ": "; + // Write out all the dependencies for this rule. + for(std::set::const_iterator d = + commandFiles.m_Depends.begin(); + d != commandFiles.m_Depends.end(); ++d) + { + std::string dep = cmSystemTools::EscapeSpaces(d->c_str()); + fout << " " << dep.c_str(); + } + fout << "\n\t" << command.c_str() << "\n\n"; } // Write a rule for every output generated by this command. for(std::set::const_iterator output = -- cgit v0.12