Hide Makefile local object info inside local generator

Make cmLocalUnixMakefileGenerator3::LocalObjectInfo private and add
cmLocalUnixMakefileGenerator3::AddLocalObjectFile to create entries.
This commit is contained in:
Brad King 2012-03-06 14:42:40 -05:00
parent 67734be8cf
commit 0996f2a228
3 changed files with 39 additions and 31 deletions

View File

@ -144,6 +144,20 @@ void cmLocalUnixMakefileGenerator3::Generate()
this->WriteDirectoryInformationFile(); this->WriteDirectoryInformationFile();
} }
//----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3::AddLocalObjectFile(
cmTarget* target, cmSourceFile* sf, std::string objNoTargetDir,
bool hasSourceExtension)
{
if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str()))
{
objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir);
}
LocalObjectInfo& info = this->LocalObjectFiles[objNoTargetDir];
info.HasSourceExtension = hasSourceExtension;
info.push_back(LocalObjectEntry(target, sf->GetLanguage()));
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets
(std::vector<std::string>& targets) (std::vector<std::string>& targets)

View File

@ -225,24 +225,9 @@ public:
// write the target rules for the local Makefile into the stream // write the target rules for the local Makefile into the stream
void WriteLocalAllRules(std::ostream& ruleFileStream); void WriteLocalAllRules(std::ostream& ruleFileStream);
struct LocalObjectEntry void AddLocalObjectFile(cmTarget* target, cmSourceFile* sf,
{ std::string objNoTargetDir,
cmTarget* Target; bool hasSourceExtension);
std::string Language;
LocalObjectEntry(): Target(0), Language() {}
LocalObjectEntry(cmTarget* t, const char* lang):
Target(t), Language(lang) {}
};
struct LocalObjectInfo: public std::vector<LocalObjectEntry>
{
bool HasSourceExtension;
bool HasPreprocessRule;
bool HasAssembleRule;
LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false),
HasAssembleRule(false) {}
};
std::map<cmStdString, LocalObjectInfo> const& GetLocalObjectFiles()
{ return this->LocalObjectFiles;}
std::vector<cmStdString> const& GetLocalHelp() { return this->LocalHelp; } std::vector<cmStdString> const& GetLocalHelp() { return this->LocalHelp; }
@ -298,9 +283,6 @@ protected:
void WriteTargetRequiresRule(std::ostream& ruleFileStream, void WriteTargetRequiresRule(std::ostream& ruleFileStream,
cmTarget& target, cmTarget& target,
const std::vector<std::string>& objects); const std::vector<std::string>& objects);
void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
const char* comment, const char* output,
LocalObjectInfo const& info);
std::string GetObjectFileName(cmTarget& target, std::string GetObjectFileName(cmTarget& target,
const cmSourceFile& source, const cmSourceFile& source,
@ -375,7 +357,27 @@ private:
bool SkipPreprocessedSourceRules; bool SkipPreprocessedSourceRules;
bool SkipAssemblySourceRules; bool SkipAssemblySourceRules;
struct LocalObjectEntry
{
cmTarget* Target;
std::string Language;
LocalObjectEntry(): Target(0), Language() {}
LocalObjectEntry(cmTarget* t, const char* lang):
Target(t), Language(lang) {}
};
struct LocalObjectInfo: public std::vector<LocalObjectEntry>
{
bool HasSourceExtension;
bool HasPreprocessRule;
bool HasAssembleRule;
LocalObjectInfo():HasSourceExtension(false), HasPreprocessRule(false),
HasAssembleRule(false) {}
};
std::map<cmStdString, LocalObjectInfo> LocalObjectFiles; std::map<cmStdString, LocalObjectInfo> LocalObjectFiles;
void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
const char* comment, const char* output,
LocalObjectInfo const& info);
std::vector<cmStdString> LocalHelp; std::vector<cmStdString> LocalHelp;
/* does the work for each target */ /* does the work for each target */

View File

@ -489,16 +489,8 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
srcFullPath.c_str()); srcFullPath.c_str());
// add this to the list of objects for this local generator // add this to the list of objects for this local generator
if(cmSystemTools::FileIsFullPath(objNoTargetDir.c_str())) this->LocalGenerator->AddLocalObjectFile(
{ this->Target, &source, objNoTargetDir, hasSourceExtension);
objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir);
}
cmLocalUnixMakefileGenerator3::LocalObjectInfo& info =
this->LocalGenerator->LocalObjectFiles[objNoTargetDir];
info.HasSourceExtension = hasSourceExtension;
info.push_back(
cmLocalUnixMakefileGenerator3::LocalObjectEntry(this->Target, lang)
);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------