Makefile: Workaround Borland Make bug with multiple outputs

Given a rule of the form

  out1 out2: dep1
  out1 out2: dep2

Borland Make complains that there are multiple rules for "out1"
even though this works when there is only one output.  Instead
generate

  out1 out2: dep1 dep2

for Borland Make, but only when there are multiple outputs.
This commit is contained in:
Brad King 2014-12-06 07:36:52 -05:00
parent 65ea5eb721
commit 6c67b8168c
3 changed files with 19 additions and 0 deletions

View File

@ -49,6 +49,7 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator()
lg->SetUnixCD(false); lg->SetUnixCD(false);
lg->SetMakeCommandEscapeTargetTwice(true); lg->SetMakeCommandEscapeTargetTwice(true);
lg->SetBorlandMakeCurlyHack(true); lg->SetBorlandMakeCurlyHack(true);
lg->SetNoMultiOutputMultiDepRules(true);
return lg; return lg;
} }

View File

@ -92,6 +92,7 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
this->SkipAssemblySourceRules = false; this->SkipAssemblySourceRules = false;
this->MakeCommandEscapeTargetTwice = false; this->MakeCommandEscapeTargetTwice = false;
this->BorlandMakeCurlyHack = false; this->BorlandMakeCurlyHack = false;
this->NoMultiOutputMultiDepRules = false;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -696,6 +697,19 @@ cmLocalUnixMakefileGenerator3
// No dependencies. The commands will always run. // No dependencies. The commands will always run.
os << cmMakeSafe(tgt) << space << ":\n"; os << cmMakeSafe(tgt) << space << ":\n";
} }
else if(this->NoMultiOutputMultiDepRules && outputs.size() >= 2)
{
// Borland make does not understand multiple dependency rules when
// there are multiple outputs, so write them all on one line.
os << cmMakeSafe(tgt) << space << ":";
for(std::vector<std::string>::const_iterator dep = depends.begin();
dep != depends.end(); ++dep)
{
replace = this->Convert(*dep, HOME_OUTPUT, MAKERULE);
os << " " << cmMakeSafe(replace);
}
os << "\n";
}
else else
{ {
// Split dependencies into multiple rule lines. This allows for // Split dependencies into multiple rule lines. This allows for

View File

@ -161,6 +161,9 @@ public:
void SetBorlandMakeCurlyHack(bool b) void SetBorlandMakeCurlyHack(bool b)
{ this->BorlandMakeCurlyHack = b; } { this->BorlandMakeCurlyHack = b; }
void SetNoMultiOutputMultiDepRules(bool b)
{ this->NoMultiOutputMultiDepRules = b; }
// used in writing out Cmake files such as WriteDirectoryInformation // used in writing out Cmake files such as WriteDirectoryInformation
static void WriteCMakeArgument(std::ostream& os, const char* s); static void WriteCMakeArgument(std::ostream& os, const char* s);
@ -345,6 +348,7 @@ private:
bool PassMakeflags; bool PassMakeflags;
bool MakeCommandEscapeTargetTwice; bool MakeCommandEscapeTargetTwice;
bool BorlandMakeCurlyHack; bool BorlandMakeCurlyHack;
bool NoMultiOutputMultiDepRules;
//========================================================================== //==========================================================================
std::string HomeRelativeOutputPath; std::string HomeRelativeOutputPath;