Build object library targets in Makefiles

Treat OBJECT libraries as STATIC libraries but leave out the archive
step.  The object files will be left behind for reference by other
targets later.
This commit is contained in:
Brad King
2012-03-12 10:54:37 -04:00
parent b87d7a60a0
commit 3aa741acb6
6 changed files with 58 additions and 14 deletions
@@ -101,6 +101,9 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
this->WriteModuleLibraryRules(true);
}
break;
case cmTarget::OBJECT_LIBRARY:
this->WriteObjectLibraryRules();
break;
default:
// If language is not known, this is an error.
cmSystemTools::Error("Unknown Library Type");
@@ -121,6 +124,29 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
this->CloseFileStreams();
}
//----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
{
std::vector<std::string> commands;
std::vector<std::string> depends;
// Add post-build rules.
this->LocalGenerator->
AppendCustomCommands(commands, this->Target->GetPostBuildCommands(),
this->Target);
// Depend on the object files.
this->AppendObjectDepends(depends);
// Write the rule.
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
this->Target->GetName(),
depends, commands, true);
// Write the main driver rule to build everything in this target.
this->WriteTargetDriverRule(this->Target->GetName(), false);
}
//----------------------------------------------------------------------------
void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules()
{