Merge topic 'refactor-makerule-path-conversion'

848fab95 cmGlobalVisualStudio7Generator: Remove unused variable
85cea8a7 cmDepends: Refactor object file path conversion
e7ee892b cmLocalGenerator: Fix AddBuildTargetRule object file path conversion
9f92a78b cmLocalGenerator: Rename 'MAKEFILE' to 'MAKERULE'
This commit is contained in:
Brad King 2014-07-23 09:44:35 -04:00 committed by CMake Topic Stage
commit fe4e6ed991
10 changed files with 40 additions and 35 deletions

View File

@ -58,12 +58,7 @@ bool cmDepends::Write(std::ostream &makeDepends,
// Get the source and object file.
std::string const& src = *si++;
if(si == pairs.end()) { break; }
std::string obj = *si++;
// Make sure the object file is relative to the top of the build tree.
obj = this->LocalGenerator->Convert(obj,
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE);
std::string const& obj = *si++;
dependencies[obj].insert(src);
}
for(std::map<std::string, std::set<std::string> >::const_iterator

View File

@ -269,14 +269,20 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// written by the original local generator for this directory
// convert the dependencies to paths relative to the home output
// directory. We must do the same here.
internalDepends << obj << std::endl;
std::string obj_i =
this->LocalGenerator->Convert(obj, cmLocalGenerator::HOME_OUTPUT);
std::string obj_m =
this->LocalGenerator->ConvertToOutputFormat(obj_i,
cmLocalGenerator::MAKERULE);
internalDepends << obj_i << std::endl;
for(std::set<std::string>::const_iterator i=dependencies.begin();
i != dependencies.end(); ++i)
{
makeDepends << obj << ": " <<
makeDepends << obj_m << ": " <<
this->LocalGenerator->Convert(*i,
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE)
cmLocalGenerator::MAKERULE)
<< std::endl;
internalDepends << " " << *i << std::endl;
}

View File

@ -443,15 +443,20 @@ cmDependsFortran
const char* src = info.Source.c_str();
// Write the include dependencies to the output stream.
internalDepends << obj << std::endl;
std::string obj_i =
this->LocalGenerator->Convert(obj, cmLocalGenerator::HOME_OUTPUT);
std::string obj_m =
this->LocalGenerator->ConvertToOutputFormat(obj_i,
cmLocalGenerator::MAKERULE);
internalDepends << obj_i << std::endl;
internalDepends << " " << src << std::endl;
for(std::set<std::string>::const_iterator i = info.Includes.begin();
i != info.Includes.end(); ++i)
{
makeDepends << obj << ": " <<
makeDepends << obj_m << ": " <<
this->LocalGenerator->Convert(*i,
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE)
cmLocalGenerator::MAKERULE)
<< std::endl;
internalDepends << " " << *i << std::endl;
}
@ -482,10 +487,10 @@ cmDependsFortran
proxy += ".mod.proxy";
proxy = this->LocalGenerator->Convert(proxy,
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE);
cmLocalGenerator::MAKERULE);
// since we require some things add them to our list of requirements
makeDepends << obj << ".requires: " << proxy << std::endl;
makeDepends << obj_m << ".requires: " << proxy << std::endl;
}
// The object file should depend on timestamped files for the
@ -499,8 +504,8 @@ cmDependsFortran
std::string stampFile =
this->LocalGenerator->Convert(required->second,
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE);
makeDepends << obj << ": " << stampFile << "\n";
cmLocalGenerator::MAKERULE);
makeDepends << obj_m << ": " << stampFile << "\n";
}
else
{
@ -512,8 +517,8 @@ cmDependsFortran
module =
this->LocalGenerator->Convert(module,
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE);
makeDepends << obj << ": " << module << "\n";
cmLocalGenerator::MAKERULE);
makeDepends << obj_m << ": " << module << "\n";
}
}
}
@ -528,8 +533,8 @@ cmDependsFortran
proxy += ".mod.proxy";
proxy = this->LocalGenerator->Convert(proxy,
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE);
makeDepends << proxy << ": " << obj << ".provides" << std::endl;
cmLocalGenerator::MAKERULE);
makeDepends << proxy << ": " << obj_m << ".provides" << std::endl;
}
// If any modules are provided then they must be converted to stamp files.
@ -537,7 +542,7 @@ cmDependsFortran
{
// Create a target to copy the module after the object file
// changes.
makeDepends << obj << ".provides.build:\n";
makeDepends << obj_m << ".provides.build:\n";
for(std::set<std::string>::const_iterator i = info.Provides.begin();
i != info.Provides.end(); ++i)
{
@ -575,7 +580,7 @@ cmDependsFortran
}
// After copying the modules update the timestamp file so that
// copying will not be done again until the source rebuilds.
makeDepends << "\t$(CMAKE_COMMAND) -E touch " << obj
makeDepends << "\t$(CMAKE_COMMAND) -E touch " << obj_m
<< ".provides.build\n";
// Make sure the module timestamp rule is evaluated by the time
@ -584,8 +589,8 @@ cmDependsFortran
driver += "/build";
driver = this->LocalGenerator->Convert(driver,
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE);
makeDepends << driver << ": " << obj << ".provides.build\n";
cmLocalGenerator::MAKERULE);
makeDepends << driver << ": " << obj_m << ".provides.build\n";
}
return true;

View File

@ -530,7 +530,7 @@ cmGlobalUnixMakefileGenerator3
// Begin the directory-level rules section.
std::string dir = lg->GetMakefile()->GetStartOutputDirectory();
dir = lg->Convert(dir, cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE);
cmLocalGenerator::MAKERULE);
lg->WriteDivider(ruleFileStream);
ruleFileStream
<< "# Directory level rules for directory "

View File

@ -773,7 +773,6 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout,
const char* typeGuid,
const std::set<std::string>&)
{
std::string d = cmSystemTools::ConvertToOutputPath(location);
fout << "Project("
<< "\"{"
<< (typeGuid ? typeGuid : this->ExternalProjectType(location))

View File

@ -681,7 +681,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
objVector.push_back(ofname);
this->AddCustomCommandToCreateObject(ofname.c_str(),
llang, *(*i), target);
objs += this->Convert(ofname,START_OUTPUT,MAKEFILE);
objs += this->Convert(ofname,START_OUTPUT,SHELL);
objs += " ";
}
}
@ -2755,7 +2755,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
{
std::string result = source;
// Convert it to an output path.
if (output == MAKEFILE)
if (output == MAKERULE)
{
result = cmSystemTools::ConvertToOutputPath(result.c_str());
}

View File

@ -106,7 +106,7 @@ public:
* path setting
*/
enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT };
enum OutputFormat { UNCHANGED, MAKEFILE, SHELL, WATCOMQUOTE, RESPONSE };
enum OutputFormat { UNCHANGED, MAKERULE, SHELL, WATCOMQUOTE, RESPONSE };
std::string ConvertToOutputFormat(const std::string& source,
OutputFormat output);
std::string Convert(const std::string& remote, RelativeRoot local,

View File

@ -630,7 +630,7 @@ cmLocalUnixMakefileGenerator3
// Construct the left hand side of the rule.
replace = target;
std::string tgt = this->Convert(replace,HOME_OUTPUT,MAKEFILE);
std::string tgt = this->Convert(replace,HOME_OUTPUT,MAKERULE);
const char* space = "";
if(tgt.size() == 1)
{
@ -663,7 +663,7 @@ cmLocalUnixMakefileGenerator3
dep != depends.end(); ++dep)
{
replace = *dep;
replace = this->Convert(replace,HOME_OUTPUT,MAKEFILE);
replace = this->Convert(replace,HOME_OUTPUT,MAKERULE);
os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
}
}

View File

@ -218,7 +218,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< this->LocalGenerator->IncludeDirective << " " << root
<< this->Convert(dependFileNameFull,
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE)
cmLocalGenerator::MAKERULE)
<< "\n\n";
if(!this->NoRuleMessages)
@ -229,7 +229,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< this->LocalGenerator->IncludeDirective << " " << root
<< this->Convert(this->ProgressFileNameFull,
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE)
cmLocalGenerator::MAKERULE)
<< "\n\n";
}
@ -262,7 +262,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
<< this->LocalGenerator->IncludeDirective << " " << root
<< this->Convert(this->FlagFileNameFull,
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE)
cmLocalGenerator::MAKERULE)
<< "\n\n";
}

View File

@ -54,7 +54,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
<< this->LocalGenerator->IncludeDirective << " " << root
<< this->Convert(this->ProgressFileNameFull,
cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKEFILE)
cmLocalGenerator::MAKERULE)
<< "\n\n";
}