ENH: Made cmMakefileTargetGenerator::GlobalGenerator have full type cmGlobalUnixMakefileGenerator3 to give access to all methods. Fixed broken custom targets with no commands for Borland makefiles when CMAKE_SKIP_RULE_DEPENDENCY is set.

This commit is contained in:
Brad King 2006-12-14 14:30:41 -05:00
parent 1fe21ae35e
commit f7611f167c
6 changed files with 24 additions and 10 deletions

View File

@ -115,6 +115,9 @@ public:
no rule. This is used for multiple output dependencies. */ no rule. This is used for multiple output dependencies. */
std::string GetEmptyCommandHack() { return this->EmptyCommandsHack; } std::string GetEmptyCommandHack() { return this->EmptyCommandsHack; }
/** Get the fake dependency to use when a rule has no real commands
or dependencies. */
std::string GetEmptyRuleHackDepends() { return this->EmptyRuleHackDepends; }
// change the build command for speed // change the build command for speed
virtual std::string GenerateBuildCommand virtual std::string GenerateBuildCommand

View File

@ -17,7 +17,7 @@
#include "cmMakefileExecutableTargetGenerator.h" #include "cmMakefileExecutableTargetGenerator.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h" #include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"

View File

@ -17,7 +17,7 @@
#include "cmMakefileLibraryTargetGenerator.h" #include "cmMakefileLibraryTargetGenerator.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h" #include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"

View File

@ -65,7 +65,8 @@ cmMakefileTargetGenerator::New(cmLocalUnixMakefileGenerator3 *lg,
result->TargetName = tgtName; result->TargetName = tgtName;
result->Target = tgt; result->Target = tgt;
result->LocalGenerator = lg; result->LocalGenerator = lg;
result->GlobalGenerator = lg->GetGlobalGenerator(); result->GlobalGenerator =
static_cast<cmGlobalUnixMakefileGenerator3*>(lg->GetGlobalGenerator());
result->Makefile = lg->GetMakefile(); result->Makefile = lg->GetMakefile();
return result; return result;
} }
@ -891,9 +892,7 @@ void cmMakefileTargetGenerator
depends.clear(); depends.clear();
depends.push_back(*o); depends.push_back(*o);
commands.clear(); commands.clear();
cmGlobalUnixMakefileGenerator3* gg = std::string emptyCommand = this->GlobalGenerator->GetEmptyCommandHack();
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
std::string emptyCommand = gg->GetEmptyCommandHack();
if(!emptyCommand.empty()) if(!emptyCommand.empty())
{ {
commands.push_back(emptyCommand); commands.push_back(emptyCommand);
@ -911,7 +910,8 @@ void cmMakefileTargetGenerator
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
o->c_str(), depends, commands, o->c_str(), depends, commands,
symbolic); symbolic);
gg->AddMultipleOutputPair(o->c_str(), depends[0].c_str()); this->GlobalGenerator->AddMultipleOutputPair(o->c_str(),
depends[0].c_str());
} }
} }

View File

@ -23,7 +23,7 @@ class cmCustomCommand;
class cmDependInformation; class cmDependInformation;
class cmDepends; class cmDepends;
class cmGeneratedFileStream; class cmGeneratedFileStream;
class cmGlobalGenerator; class cmGlobalUnixMakefileGenerator3;
class cmLocalUnixMakefileGenerator3; class cmLocalUnixMakefileGenerator3;
class cmMakeDepend; class cmMakeDepend;
class cmMakefile; class cmMakefile;
@ -121,7 +121,7 @@ protected:
cmStdString TargetName; cmStdString TargetName;
cmTarget *Target; cmTarget *Target;
cmLocalUnixMakefileGenerator3 *LocalGenerator; cmLocalUnixMakefileGenerator3 *LocalGenerator;
cmGlobalGenerator *GlobalGenerator; cmGlobalUnixMakefileGenerator3 *GlobalGenerator;
cmMakefile *Makefile; cmMakefile *Makefile;
bool DriveCustomCommandsOnDepends; bool DriveCustomCommandsOnDepends;

View File

@ -17,7 +17,7 @@
#include "cmMakefileUtilityTargetGenerator.h" #include "cmMakefileUtilityTargetGenerator.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h" #include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
@ -58,6 +58,17 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
objTarget += this->BuildFileName; objTarget += this->BuildFileName;
this->LocalGenerator->AppendRuleDepend(depends, objTarget.c_str()); this->LocalGenerator->AppendRuleDepend(depends, objTarget.c_str());
// If the rule is empty add the special empty rule dependency needed
// by some make tools.
if(depends.empty() && commands.empty())
{
std::string hack = this->GlobalGenerator->GetEmptyRuleHackDepends();
if(!hack.empty())
{
depends.push_back(hack);
}
}
// Write the rule. // Write the rule.
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
this->Target->GetName(), this->Target->GetName(),