From 112c87b28afac71617bcbb552ae1f2027bb548b6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 27 Aug 2016 13:44:53 +0200 Subject: 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_ --- Source/cmLocalUnixMakefileGenerator3.cxx | 22 ++++++++++++++++------ Source/cmLocalUnixMakefileGenerator3.h | 3 +-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f2ef5c8..f026b12 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -592,8 +592,8 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule( } } -std::string cmLocalUnixMakefileGenerator3::ConvertShellCommand( - std::string const& cmd, cmOutputConverter::RelativeRoot root) +std::string cmLocalUnixMakefileGenerator3::MaybeConvertWatcomShellCommand( + std::string const& cmd) { if (this->IsWatcomWMake() && cmSystemTools::FileIsFullPath(cmd.c_str()) && cmd.find_first_of("( )") != cmd.npos) { @@ -606,7 +606,7 @@ std::string cmLocalUnixMakefileGenerator3::ConvertShellCommand( cmOutputConverter::SHELL); } } - return this->Convert(cmd, root, cmOutputConverter::SHELL); + return std::string(); } void cmLocalUnixMakefileGenerator3::WriteMakeVariables( @@ -638,8 +638,13 @@ void cmLocalUnixMakefileGenerator3::WriteMakeVariables( #endif } - std::string cmakeShellCommand = this->ConvertShellCommand( - cmSystemTools::GetCMakeCommand(), cmOutputConverter::FULL); + std::string cmakeShellCommand = + this->MaybeConvertWatcomShellCommand(cmSystemTools::GetCMakeCommand()); + if (cmakeShellCommand.empty()) { + cmakeShellCommand = + this->Convert(cmSystemTools::GetCMakeCommand(), cmOutputConverter::FULL, + cmOutputConverter::SHELL); + } /* clang-format off */ makefileStream @@ -975,7 +980,12 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( std::string launcher = this->MakeLauncher( ccg, target, workingDir.empty() ? cmOutputConverter::START_OUTPUT : 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); if (content) { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 243cc3d..ea98607 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -250,8 +250,7 @@ protected: void CheckMultipleOutputs(bool verbose); private: - std::string ConvertShellCommand(std::string const& cmd, - cmOutputConverter::RelativeRoot root); + std::string MaybeConvertWatcomShellCommand(std::string const& cmd); std::string MakeLauncher(cmCustomCommandGenerator const& ccg, cmGeneratorTarget* target, cmOutputConverter::RelativeRoot relative); -- cgit v0.12