BUG: Added object language to list of object files in a local generator's directory. Fixed generation of preprocessing and assembly rules to be done only for C and C++ objects.
This commit is contained in:
parent
7169980b59
commit
c6f1a11480
|
@ -1231,9 +1231,10 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::map<cmStdString,std::vector<cmTarget *> > const& objs =
|
typedef cmLocalUnixMakefileGenerator3::LocalObjectInfo LocalObjectInfo;
|
||||||
|
std::map<cmStdString, LocalObjectInfo> const& objs =
|
||||||
lg->GetLocalObjectFiles();
|
lg->GetLocalObjectFiles();
|
||||||
for(std::map<cmStdString,std::vector<cmTarget *> >::const_iterator o =
|
for(std::map<cmStdString, LocalObjectInfo>::const_iterator o =
|
||||||
objs.begin(); o != objs.end(); ++o)
|
objs.begin(); o != objs.end(); ++o)
|
||||||
{
|
{
|
||||||
path = "... ";
|
path = "... ";
|
||||||
|
|
|
@ -288,7 +288,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
|
||||||
|
|
||||||
// now write out the object rules
|
// now write out the object rules
|
||||||
// for each object file name
|
// for each object file name
|
||||||
for (std::map<cmStdString,std::vector<cmTarget *> >::iterator lo =
|
for (std::map<cmStdString, LocalObjectInfo>::iterator lo =
|
||||||
this->LocalObjectFiles.begin();
|
this->LocalObjectFiles.begin();
|
||||||
lo != this->LocalObjectFiles.end(); ++lo)
|
lo != this->LocalObjectFiles.end(); ++lo)
|
||||||
{
|
{
|
||||||
|
@ -297,8 +297,20 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
|
||||||
"target to build an object file",
|
"target to build an object file",
|
||||||
lo->first.c_str(), lo->second);
|
lo->first.c_str(), lo->second);
|
||||||
|
|
||||||
|
// Check whether preprocessing and assembly rules make sense.
|
||||||
|
// They make sense only for C and C++ sources.
|
||||||
|
bool lang_is_c_or_cxx = false;
|
||||||
|
for(std::vector<LocalObjectEntry>::const_iterator ei =
|
||||||
|
lo->second.begin(); ei != lo->second.end(); ++ei)
|
||||||
|
{
|
||||||
|
if(ei->Language == "C" || ei->Language == "CXX")
|
||||||
|
{
|
||||||
|
lang_is_c_or_cxx = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add convenience rules for preprocessed and assembly files.
|
// Add convenience rules for preprocessed and assembly files.
|
||||||
if(do_preprocess_rules || do_assembly_rules)
|
if(lang_is_c_or_cxx && (do_preprocess_rules || do_assembly_rules))
|
||||||
{
|
{
|
||||||
std::string::size_type dot_pos = lo->first.rfind(".");
|
std::string::size_type dot_pos = lo->first.rfind(".");
|
||||||
std::string base = lo->first.substr(0, dot_pos);
|
std::string base = lo->first.substr(0, dot_pos);
|
||||||
|
@ -333,14 +345,15 @@ void
|
||||||
cmLocalUnixMakefileGenerator3
|
cmLocalUnixMakefileGenerator3
|
||||||
::WriteObjectConvenienceRule(std::ostream& ruleFileStream,
|
::WriteObjectConvenienceRule(std::ostream& ruleFileStream,
|
||||||
const char* comment, const char* output,
|
const char* comment, const char* output,
|
||||||
std::vector<cmTarget*>& targets)
|
LocalObjectInfo const& targets)
|
||||||
{
|
{
|
||||||
// Recursively make the rule for each target using the object file.
|
// Recursively make the rule for each target using the object file.
|
||||||
std::vector<std::string> commands;
|
std::vector<std::string> commands;
|
||||||
for(std::vector<cmTarget*>::iterator t = targets.begin();
|
for(std::vector<LocalObjectEntry>::const_iterator t = targets.begin();
|
||||||
t != targets.end(); ++t)
|
t != targets.end(); ++t)
|
||||||
{
|
{
|
||||||
std::string tgtMakefileName = this->GetRelativeTargetDirectory(**t);
|
std::string tgtMakefileName =
|
||||||
|
this->GetRelativeTargetDirectory(*(t->Target));
|
||||||
std::string targetName = tgtMakefileName;
|
std::string targetName = tgtMakefileName;
|
||||||
tgtMakefileName += "/build.make";
|
tgtMakefileName += "/build.make";
|
||||||
targetName += "/";
|
targetName += "/";
|
||||||
|
|
|
@ -202,7 +202,16 @@ 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);
|
||||||
|
|
||||||
std::map<cmStdString,std::vector<cmTarget *> > GetLocalObjectFiles()
|
struct LocalObjectEntry
|
||||||
|
{
|
||||||
|
cmTarget* Target;
|
||||||
|
std::string Language;
|
||||||
|
LocalObjectEntry(): Target(0), Language() {}
|
||||||
|
LocalObjectEntry(cmTarget* t, const char* lang):
|
||||||
|
Target(t), Language(lang) {}
|
||||||
|
};
|
||||||
|
class LocalObjectInfo: public std::vector<LocalObjectEntry> {};
|
||||||
|
std::map<cmStdString, LocalObjectInfo> const& GetLocalObjectFiles()
|
||||||
{ return this->LocalObjectFiles;}
|
{ return this->LocalObjectFiles;}
|
||||||
|
|
||||||
// return info about progress actions
|
// return info about progress actions
|
||||||
|
@ -276,7 +285,7 @@ protected:
|
||||||
const std::vector<std::string>& objects);
|
const std::vector<std::string>& objects);
|
||||||
void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
|
void WriteObjectConvenienceRule(std::ostream& ruleFileStream,
|
||||||
const char* comment, const char* output,
|
const char* comment, const char* output,
|
||||||
std::vector<cmTarget*>& targets);
|
LocalObjectInfo const& targets);
|
||||||
|
|
||||||
std::string GetObjectFileName(cmTarget& target,
|
std::string GetObjectFileName(cmTarget& target,
|
||||||
const cmSourceFile& source,
|
const cmSourceFile& source,
|
||||||
|
@ -336,7 +345,7 @@ private:
|
||||||
bool SkipPreprocessedSourceRules;
|
bool SkipPreprocessedSourceRules;
|
||||||
bool SkipAssemblySourceRules;
|
bool SkipAssemblySourceRules;
|
||||||
|
|
||||||
std::map<cmStdString,std::vector<cmTarget *> > LocalObjectFiles;
|
std::map<cmStdString, LocalObjectInfo> LocalObjectFiles;
|
||||||
|
|
||||||
/* does the work for each target */
|
/* does the work for each target */
|
||||||
std::vector<cmMakefileTargetGenerator *> TargetGenerators;
|
std::vector<cmMakefileTargetGenerator *> TargetGenerators;
|
||||||
|
|
|
@ -350,7 +350,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source)
|
||||||
objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir);
|
objNoTargetDir = cmSystemTools::GetFilenameName(objNoTargetDir);
|
||||||
}
|
}
|
||||||
this->LocalGenerator->LocalObjectFiles[objNoTargetDir].
|
this->LocalGenerator->LocalObjectFiles[objNoTargetDir].
|
||||||
push_back(this->Target);
|
push_back(
|
||||||
|
cmLocalUnixMakefileGenerator3::LocalObjectEntry(this->Target, lang)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -495,9 +497,11 @@ cmMakefileTargetGenerator
|
||||||
relativeObj.c_str(),
|
relativeObj.c_str(),
|
||||||
depends, commands, false);
|
depends, commands, false);
|
||||||
|
|
||||||
bool do_preprocess_rules =
|
bool lang_is_c_or_cxx = ((strcmp(lang, "C") == 0) ||
|
||||||
|
(strcmp(lang, "CXX") == 0));
|
||||||
|
bool do_preprocess_rules = lang_is_c_or_cxx &&
|
||||||
this->LocalGenerator->GetCreatePreprocessedSourceRules();
|
this->LocalGenerator->GetCreatePreprocessedSourceRules();
|
||||||
bool do_assembly_rules =
|
bool do_assembly_rules = lang_is_c_or_cxx &&
|
||||||
this->LocalGenerator->GetCreateAssemblySourceRules();
|
this->LocalGenerator->GetCreateAssemblySourceRules();
|
||||||
if(do_preprocess_rules || do_assembly_rules)
|
if(do_preprocess_rules || do_assembly_rules)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue