Makefiles: Replace method with Wacom specific API

The existing method uses RelativeRoot NONE and FULL values.  In
principle, those should be segregated interfaces.  Mixing
NONE and FULL into the RelativeRoot enum is a case of

 http://thedailywtf.com/articles/What_Is_Truth_0x3f_
This commit is contained in:
Stephen Kelly 2016-08-27 13:44:53 +02:00
parent cd351ef2c4
commit 112c87b28a
2 changed files with 17 additions and 8 deletions

View File

@ -592,8 +592,8 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
} }
} }
std::string cmLocalUnixMakefileGenerator3::ConvertShellCommand( std::string cmLocalUnixMakefileGenerator3::MaybeConvertWatcomShellCommand(
std::string const& cmd, cmOutputConverter::RelativeRoot root) std::string const& cmd)
{ {
if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) && if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) &&
cmd.find_first_of("( )") != cmd.npos) { cmd.find_first_of("( )") != cmd.npos) {
@ -606,7 +606,7 @@ std::string cmLocalUnixMakefileGenerator3::ConvertShellCommand(
cmOutputConverter::SHELL); cmOutputConverter::SHELL);
} }
} }
return this->Convert(cmd, root, cmOutputConverter::SHELL); return std::string();
} }
void cmLocalUnixMakefileGenerator3::WriteMakeVariables( void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
@ -638,8 +638,13 @@ void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
#endif #endif
} }
std::string cmakeShellCommand = this->ConvertShellCommand( std::string cmakeShellCommand =
cmSystemTools::GetCMakeCommand(), cmOutputConverter::FULL); this->MaybeConvertWatcomShellCommand(cmSystemTools::GetCMakeCommand());
if (cmakeShellCommand.empty()) {
cmakeShellCommand =
this->Convert(cmSystemTools::GetCMakeCommand(), cmOutputConverter::FULL,
cmOutputConverter::SHELL);
}
/* clang-format off */ /* clang-format off */
makefileStream makefileStream
@ -975,7 +980,12 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
std::string launcher = this->MakeLauncher( std::string launcher = this->MakeLauncher(
ccg, target, workingDir.empty() ? cmOutputConverter::START_OUTPUT ccg, target, workingDir.empty() ? cmOutputConverter::START_OUTPUT
: cmOutputConverter::NONE); : cmOutputConverter::NONE);
cmd = launcher + this->ConvertShellCommand(cmd, cmOutputConverter::NONE); std::string shellCommand = this->MaybeConvertWatcomShellCommand(cmd);
if (shellCommand.empty()) {
shellCommand = this->Convert(cmd, cmOutputConverter::NONE,
cmOutputConverter::SHELL);
}
cmd = launcher + shellCommand;
ccg.AppendArguments(c, cmd); ccg.AppendArguments(c, cmd);
if (content) { if (content) {

View File

@ -250,8 +250,7 @@ protected:
void CheckMultipleOutputs(bool verbose); void CheckMultipleOutputs(bool verbose);
private: private:
std::string ConvertShellCommand(std::string const& cmd, std::string MaybeConvertWatcomShellCommand(std::string const& cmd);
cmOutputConverter::RelativeRoot root);
std::string MakeLauncher(cmCustomCommandGenerator const& ccg, std::string MakeLauncher(cmCustomCommandGenerator const& ccg,
cmGeneratorTarget* target, cmGeneratorTarget* target,
cmOutputConverter::RelativeRoot relative); cmOutputConverter::RelativeRoot relative);