summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorJiri Malak <malak.jiri@gmail.com>2014-03-25 06:17:45 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-27 17:45:29 (GMT)
commit423009c17f50f837bca178a2cc5edfd62963f1ea (patch)
tree152751e8bd297948ac33517d2c8fc89e45e179df /Source
parenta863a8fecd368f3b17930dd7832fb2e0ba042616 (diff)
downloadCMake-423009c17f50f837bca178a2cc5edfd62963f1ea.zip
CMake-423009c17f50f837bca178a2cc5edfd62963f1ea.tar.gz
CMake-423009c17f50f837bca178a2cc5edfd62963f1ea.tar.bz2
Makefile: Generate single-quoted object lists for Watcom
Drop the CMAKE_NO_QUOTED_OBJECTS internal variable from the Makefile generators. The underlying problem is with the Watcom linker, not with WMake. The Watcom linker wants object files to be single-quoted. Add <LINK-RULE>_USE_WATCOM_QUOTE platform information variables to tell the generators to use Watcom-style single quotes for object files on link lines. On Windows, Watcom uses the GetCommandLine API to get the original command-line string and do custom parsing that expects single quotes. On POSIX systems, Watcom approximates the original command line by joining all argv[] entries separated by a single space. Therefore we need to double-quote the single-quoted arguments so that the shell does not consume them and they are available for the parser to see.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.cxx1
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx30
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.h3
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx5
-rw-r--r--Source/cmMakefileTargetGenerator.cxx39
-rw-r--r--Source/cmMakefileTargetGenerator.h6
7 files changed, 52 insertions, 36 deletions
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index 0ae1b34..e44ed79 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -35,7 +35,6 @@ void cmGlobalWatcomWMakeGenerator
mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1");
mf->AddDefinition("CMAKE_MAKE_LINE_CONTINUE", "&");
mf->AddDefinition("CMAKE_MAKE_SYMBOLIC_RULE", ".SYMBOLIC");
- mf->AddDefinition("CMAKE_NO_QUOTED_OBJECTS", "1");
mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl386");
mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl386");
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 8fa14d2..ff173f5 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -2181,14 +2181,27 @@ cmLocalUnixMakefileGenerator3
//----------------------------------------------------------------------------
std::string
-cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p)
+cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
+ bool useWatcomQuote)
{
// Split the path into its components.
std::vector<std::string> components;
cmSystemTools::SplitPath(p, components);
// Open the quoted result.
- std::string result = "\"";
+ std::string result;
+ if(useWatcomQuote)
+ {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ result = "'";
+#else
+ result = "\"'";
+#endif
+ }
+ else
+ {
+ result = "\"";
+ }
// Return an empty path if there are no components.
if(!components.empty())
@@ -2232,7 +2245,18 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p)
}
// Close the quoted result.
- result += "\"";
+ if(useWatcomQuote)
+ {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ result += "'";
+#else
+ result += "'\"";
+#endif
+ }
+ else
+ {
+ result += "\"";
+ }
return result;
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 14543fb..99974ee 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -186,7 +186,8 @@ public:
const char *targetDir,
cmLocalGenerator::RelativeRoot returnDir);
- static std::string ConvertToQuotedOutputPath(const char* p);
+ static std::string ConvertToQuotedOutputPath(const char* p,
+ bool useWatcomQuote);
std::string CreateMakeVariable(const std::string& sin,
const std::string& s2in);
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index a61005b..701d5a0 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -290,6 +290,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
linkRuleVar += linkLanguage;
linkRuleVar += "_LINK_EXECUTABLE";
std::string linkRule = this->GetLinkRule(linkRuleVar);
+ bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE");
std::vector<std::string> commands1;
cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
if(this->Target->IsExecutableWithExports())
@@ -343,7 +344,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// rule.
std::string buildObjs;
this->CreateObjectLists(useLinkScript, false,
- useResponseFileForObjects, buildObjs, depends);
+ useResponseFileForObjects, buildObjs, depends,
+ useWatcomQuote);
cmLocalGenerator::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_LINK";
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 02469d1..754f62f 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -458,6 +458,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
this->Target);
}
+ bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE");
+
// Determine whether a link script will be used.
bool useLinkScript = this->GlobalGenerator->GetUseLinkScript();
@@ -553,7 +555,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// rule.
std::string buildObjs;
this->CreateObjectLists(useLinkScript, useArchiveRules,
- useResponseFileForObjects, buildObjs, depends);
+ useResponseFileForObjects, buildObjs, depends,
+ useWatcomQuote);
cmLocalGenerator::RuleVariables vars;
vars.TargetPDB = targetOutPathPDB.c_str();
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 6759d05..b3d3f71 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1349,7 +1349,8 @@ cmMakefileTargetGenerator::AppendProgress(std::vector<std::string>& commands)
void
cmMakefileTargetGenerator
::WriteObjectsVariable(std::string& variableName,
- std::string& variableNameExternal)
+ std::string& variableNameExternal,
+ bool useWatcomQuote)
{
// Write a make variable assignment that lists all objects for the
// target.
@@ -1360,8 +1361,6 @@ cmMakefileTargetGenerator
<< "# Object files for target " << this->Target->GetName() << "\n"
<< variableName << " =";
std::string object;
- const char* objName =
- this->Makefile->GetDefinition("CMAKE_NO_QUOTED_OBJECTS");
const char* lineContinue =
this->Makefile->GetDefinition("CMAKE_MAKE_LINE_CONTINUE");
if(!lineContinue)
@@ -1372,17 +1371,9 @@ cmMakefileTargetGenerator
i != this->Objects.end(); ++i)
{
*this->BuildFileStream << " " << lineContinue << "\n";
- if(objName)
- {
- *this->BuildFileStream <<
- this->Convert(*i, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::MAKEFILE);
- }
- else
- {
- *this->BuildFileStream <<
- this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str());
- }
+ *this->BuildFileStream <<
+ this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str(),
+ useWatcomQuote);
}
*this->BuildFileStream << "\n";
@@ -1404,17 +1395,9 @@ cmMakefileTargetGenerator
*this->BuildFileStream
<< " " << lineContinue << "\n"
<< this->Makefile->GetSafeDefinition("CMAKE_OBJECT_NAME");
- if(objName)
- {
- *this->BuildFileStream <<
- this->Convert(*i, cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::MAKEFILE);
- }
- else
- {
- *this->BuildFileStream <<
- this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str());
- }
+ *this->BuildFileStream <<
+ this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str(),
+ useWatcomQuote);
}
*this->BuildFileStream << "\n" << "\n";
}
@@ -1882,11 +1865,13 @@ void
cmMakefileTargetGenerator
::CreateObjectLists(bool useLinkScript, bool useArchiveRules,
bool useResponseFile, std::string& buildObjs,
- std::vector<std::string>& makefile_depends)
+ std::vector<std::string>& makefile_depends,
+ bool useWatcomQuote)
{
std::string variableName;
std::string variableNameExternal;
- this->WriteObjectsVariable(variableName, variableNameExternal);
+ this->WriteObjectsVariable(variableName, variableNameExternal,
+ useWatcomQuote);
if(useResponseFile)
{
// MSVC response files cannot exceed 128K.
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 7ff6da9..ff94660 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -113,7 +113,8 @@ protected:
// write out the variable that lists the objects for this target
void WriteObjectsVariable(std::string& variableName,
- std::string& variableNameExternal);
+ std::string& variableNameExternal,
+ bool useWatcomQuote);
void WriteObjectsString(std::string& buildObjs);
void WriteObjectsStrings(std::vector<std::string>& objStrings,
std::string::size_type limit = std::string::npos);
@@ -172,7 +173,8 @@ protected:
/** Create lists of object files for linking and cleaning. */
void CreateObjectLists(bool useLinkScript, bool useArchiveRules,
bool useResponseFile, std::string& buildObjs,
- std::vector<std::string>& makefile_depends);
+ std::vector<std::string>& makefile_depends,
+ bool useWatcomQuote);
void AddIncludeFlags(std::string& flags, const std::string& lang);