Merge topic 'makefile-DELETE_ON_ERROR'

44990732 Help: Add notes for topic 'makefile-DELETE_ON_ERROR'
4adf1dad Makefile: Tell GNU make to delete rule outputs on error (#15474)
This commit is contained in:
Brad King 2015-04-01 13:19:32 -04:00 committed by CMake Topic Stage
commit aa508a5299
5 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,7 @@
makefile-DELETE_ON_ERROR
------------------------
* The Makefile generators now add ``.DELETE_ON_ERROR`` to the
makefiles that contain the actual build rules for files on disk.
This tells GNU make to remove rule outputs when their recipe
modifies an output but fails.

View File

@ -46,6 +46,7 @@ public:
cmMakefile *, bool optional);
virtual bool AllowNotParallel() const { return false; }
virtual bool AllowDeleteOnError() const { return false; }
};
#endif

View File

@ -128,6 +128,9 @@ public:
/** Does the make tool tolerate .NOTPARALLEL? */
virtual bool AllowNotParallel() const { return true; }
/** Does the make tool tolerate .DELETE_ON_ERROR? */
virtual bool AllowDeleteOnError() const { return true; }
virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
protected:
void WriteMainMakefile2();

View File

@ -45,6 +45,7 @@ public:
cmMakefile *, bool optional);
virtual bool AllowNotParallel() const { return false; }
virtual bool AllowDeleteOnError() const { return false; }
};
#endif

View File

@ -122,6 +122,14 @@ void cmMakefileTargetGenerator::CreateRuleFile()
return;
}
this->LocalGenerator->WriteDisclaimer(*this->BuildFileStream);
if (this->GlobalGenerator->AllowDeleteOnError())
{
std::vector<std::string> no_depends;
std::vector<std::string> no_commands;
this->LocalGenerator->WriteMakeRule(
*this->BuildFileStream, "Delete rule output on recipe failure.",
".DELETE_ON_ERROR", no_depends, no_commands, false);
}
this->LocalGenerator->WriteSpecialTargetsTop(*this->BuildFileStream);
}