fixes for untiltiy targets in all

This commit is contained in:
Ken Martin 2001-05-04 17:00:22 -04:00
parent 1349d06e78
commit e126954393
2 changed files with 29 additions and 6 deletions

View File

@ -467,6 +467,7 @@ void cmMakefile::AddLibrary(const char* lname, const std::vector<std::string> &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));
}

View File

@ -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();
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\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<std::string>::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<std::string>::const_iterator output =