Makefiles: Change AppendCustomCommand API to strings
Avoid the RelativeRoot enum. Supply the HOME_OUTPUT string at each callsite to make the parameter non-defaulted.
This commit is contained in:
parent
6960516b6b
commit
c341f4679a
|
@ -900,7 +900,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomDepend(
|
||||||
|
|
||||||
void cmLocalUnixMakefileGenerator3::AppendCustomCommands(
|
void cmLocalUnixMakefileGenerator3::AppendCustomCommands(
|
||||||
std::vector<std::string>& commands, const std::vector<cmCustomCommand>& ccs,
|
std::vector<std::string>& commands, const std::vector<cmCustomCommand>& ccs,
|
||||||
cmGeneratorTarget* target, cmOutputConverter::RelativeRoot relative)
|
cmGeneratorTarget* target, std::string const& relative)
|
||||||
{
|
{
|
||||||
for (std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
|
for (std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
|
||||||
i != ccs.end(); ++i) {
|
i != ccs.end(); ++i) {
|
||||||
|
@ -911,8 +911,8 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommands(
|
||||||
|
|
||||||
void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
|
void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
|
||||||
std::vector<std::string>& commands, cmCustomCommandGenerator const& ccg,
|
std::vector<std::string>& commands, cmCustomCommandGenerator const& ccg,
|
||||||
cmGeneratorTarget* target, cmOutputConverter::RelativeRoot relative,
|
cmGeneratorTarget* target, std::string const& relative, bool echo_comment,
|
||||||
bool echo_comment, std::ostream* content)
|
std::ostream* content)
|
||||||
{
|
{
|
||||||
// Optionally create a command to display the custom command's
|
// Optionally create a command to display the custom command's
|
||||||
// comment text. This is used for pre-build, pre-link, and
|
// comment text. This is used for pre-build, pre-link, and
|
||||||
|
@ -1011,8 +1011,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the proper working directory for the commands.
|
// Setup the proper working directory for the commands.
|
||||||
std::string relativeDir = this->GetRelativeRootPath(relative);
|
this->CreateCDCommand(commands1, dir.c_str(), relative);
|
||||||
this->CreateCDCommand(commands1, dir.c_str(), relativeDir);
|
|
||||||
|
|
||||||
// push back the custom commands
|
// push back the custom commands
|
||||||
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
commands.insert(commands.end(), commands1.begin(), commands1.end());
|
||||||
|
@ -1559,9 +1558,9 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
|
||||||
this->AppendCustomDepends(depends, gt->GetPreBuildCommands());
|
this->AppendCustomDepends(depends, gt->GetPreBuildCommands());
|
||||||
this->AppendCustomDepends(depends, gt->GetPostBuildCommands());
|
this->AppendCustomDepends(depends, gt->GetPostBuildCommands());
|
||||||
this->AppendCustomCommands(commands, gt->GetPreBuildCommands(), gt,
|
this->AppendCustomCommands(commands, gt->GetPreBuildCommands(), gt,
|
||||||
cmOutputConverter::START_OUTPUT);
|
this->GetCurrentBinaryDirectory());
|
||||||
this->AppendCustomCommands(commands, gt->GetPostBuildCommands(), gt,
|
this->AppendCustomCommands(commands, gt->GetPostBuildCommands(), gt,
|
||||||
cmOutputConverter::START_OUTPUT);
|
this->GetCurrentBinaryDirectory());
|
||||||
std::string targetName = gt->GetName();
|
std::string targetName = gt->GetName();
|
||||||
this->WriteMakeRule(ruleFileStream, targetString.c_str(), targetName,
|
this->WriteMakeRule(ruleFileStream, targetString.c_str(), targetName,
|
||||||
depends, commands, true);
|
depends, commands, true);
|
||||||
|
|
|
@ -228,15 +228,16 @@ protected:
|
||||||
const std::vector<cmCustomCommand>& ccs);
|
const std::vector<cmCustomCommand>& ccs);
|
||||||
void AppendCustomDepend(std::vector<std::string>& depends,
|
void AppendCustomDepend(std::vector<std::string>& depends,
|
||||||
cmCustomCommandGenerator const& cc);
|
cmCustomCommandGenerator const& cc);
|
||||||
void AppendCustomCommands(
|
void AppendCustomCommands(std::vector<std::string>& commands,
|
||||||
std::vector<std::string>& commands,
|
const std::vector<cmCustomCommand>& ccs,
|
||||||
const std::vector<cmCustomCommand>& ccs, cmGeneratorTarget* target,
|
cmGeneratorTarget* target,
|
||||||
cmOutputConverter::RelativeRoot relative = cmOutputConverter::HOME_OUTPUT);
|
std::string const& relative);
|
||||||
void AppendCustomCommand(
|
void AppendCustomCommand(std::vector<std::string>& commands,
|
||||||
std::vector<std::string>& commands, cmCustomCommandGenerator const& ccg,
|
cmCustomCommandGenerator const& ccg,
|
||||||
cmGeneratorTarget* target,
|
cmGeneratorTarget* target,
|
||||||
cmOutputConverter::RelativeRoot relative = cmOutputConverter::HOME_OUTPUT,
|
std::string const& relative,
|
||||||
bool echo_comment = false, std::ostream* content = CM_NULLPTR);
|
bool echo_comment = false,
|
||||||
|
std::ostream* content = CM_NULLPTR);
|
||||||
void AppendCleanCommand(std::vector<std::string>& commands,
|
void AppendCleanCommand(std::vector<std::string>& commands,
|
||||||
const std::vector<std::string>& files,
|
const std::vector<std::string>& files,
|
||||||
cmGeneratorTarget* target,
|
cmGeneratorTarget* target,
|
||||||
|
|
|
@ -257,10 +257,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
if (!relink) {
|
if (!relink) {
|
||||||
this->LocalGenerator->AppendCustomCommands(
|
this->LocalGenerator->AppendCustomCommands(
|
||||||
commands, this->GeneratorTarget->GetPreBuildCommands(),
|
commands, this->GeneratorTarget->GetPreBuildCommands(),
|
||||||
this->GeneratorTarget);
|
this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
|
||||||
this->LocalGenerator->AppendCustomCommands(
|
this->LocalGenerator->AppendCustomCommands(
|
||||||
commands, this->GeneratorTarget->GetPreLinkCommands(),
|
commands, this->GeneratorTarget->GetPreLinkCommands(),
|
||||||
this->GeneratorTarget);
|
this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine whether a link script will be used.
|
// Determine whether a link script will be used.
|
||||||
|
@ -411,7 +411,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
if (!relink) {
|
if (!relink) {
|
||||||
this->LocalGenerator->AppendCustomCommands(
|
this->LocalGenerator->AppendCustomCommands(
|
||||||
commands, this->GeneratorTarget->GetPostBuildCommands(),
|
commands, this->GeneratorTarget->GetPostBuildCommands(),
|
||||||
this->GeneratorTarget);
|
this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the build rule.
|
// Write the build rule.
|
||||||
|
|
|
@ -112,7 +112,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules()
|
||||||
// Add post-build rules.
|
// Add post-build rules.
|
||||||
this->LocalGenerator->AppendCustomCommands(
|
this->LocalGenerator->AppendCustomCommands(
|
||||||
commands, this->GeneratorTarget->GetPostBuildCommands(),
|
commands, this->GeneratorTarget->GetPostBuildCommands(),
|
||||||
this->GeneratorTarget);
|
this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
|
||||||
|
|
||||||
// Depend on the object files.
|
// Depend on the object files.
|
||||||
this->AppendObjectDepends(depends);
|
this->AppendObjectDepends(depends);
|
||||||
|
@ -427,10 +427,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
|
||||||
if (!relink) {
|
if (!relink) {
|
||||||
this->LocalGenerator->AppendCustomCommands(
|
this->LocalGenerator->AppendCustomCommands(
|
||||||
commands, this->GeneratorTarget->GetPreBuildCommands(),
|
commands, this->GeneratorTarget->GetPreBuildCommands(),
|
||||||
this->GeneratorTarget);
|
this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
|
||||||
this->LocalGenerator->AppendCustomCommands(
|
this->LocalGenerator->AppendCustomCommands(
|
||||||
commands, this->GeneratorTarget->GetPreLinkCommands(),
|
commands, this->GeneratorTarget->GetPreLinkCommands(),
|
||||||
this->GeneratorTarget);
|
this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine whether a link script will be used.
|
// Determine whether a link script will be used.
|
||||||
|
@ -698,7 +698,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
|
||||||
if (!relink) {
|
if (!relink) {
|
||||||
this->LocalGenerator->AppendCustomCommands(
|
this->LocalGenerator->AppendCustomCommands(
|
||||||
commands, this->GeneratorTarget->GetPostBuildCommands(),
|
commands, this->GeneratorTarget->GetPostBuildCommands(),
|
||||||
this->GeneratorTarget);
|
this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the list of outputs.
|
// Compute the list of outputs.
|
||||||
|
|
|
@ -1094,8 +1094,8 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
|
||||||
// Now append the actual user-specified commands.
|
// Now append the actual user-specified commands.
|
||||||
std::ostringstream content;
|
std::ostringstream content;
|
||||||
this->LocalGenerator->AppendCustomCommand(
|
this->LocalGenerator->AppendCustomCommand(
|
||||||
commands, ccg, this->GeneratorTarget, cmOutputConverter::HOME_OUTPUT,
|
commands, ccg, this->GeneratorTarget,
|
||||||
false, &content);
|
this->LocalGenerator->GetBinaryDirectory(), false, &content);
|
||||||
|
|
||||||
// Collect the dependencies.
|
// Collect the dependencies.
|
||||||
std::vector<std::string> depends;
|
std::vector<std::string> depends;
|
||||||
|
|
|
@ -75,14 +75,14 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
|
||||||
|
|
||||||
this->LocalGenerator->AppendCustomCommands(
|
this->LocalGenerator->AppendCustomCommands(
|
||||||
commands, this->GeneratorTarget->GetPreBuildCommands(),
|
commands, this->GeneratorTarget->GetPreBuildCommands(),
|
||||||
this->GeneratorTarget);
|
this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
|
||||||
|
|
||||||
// Depend on all custom command outputs for sources
|
// Depend on all custom command outputs for sources
|
||||||
this->DriveCustomCommands(depends);
|
this->DriveCustomCommands(depends);
|
||||||
|
|
||||||
this->LocalGenerator->AppendCustomCommands(
|
this->LocalGenerator->AppendCustomCommands(
|
||||||
commands, this->GeneratorTarget->GetPostBuildCommands(),
|
commands, this->GeneratorTarget->GetPostBuildCommands(),
|
||||||
this->GeneratorTarget);
|
this->GeneratorTarget, this->LocalGenerator->GetBinaryDirectory());
|
||||||
|
|
||||||
// Add dependencies on targets that must be built first.
|
// Add dependencies on targets that must be built first.
|
||||||
this->AppendTargetDepends(depends);
|
this->AppendTargetDepends(depends);
|
||||||
|
|
Loading…
Reference in New Issue