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:
commit
aa508a5299
|
@ -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.
|
|
@ -46,6 +46,7 @@ public:
|
|||
cmMakefile *, bool optional);
|
||||
|
||||
virtual bool AllowNotParallel() const { return false; }
|
||||
virtual bool AllowDeleteOnError() const { return false; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
cmMakefile *, bool optional);
|
||||
|
||||
virtual bool AllowNotParallel() const { return false; }
|
||||
virtual bool AllowDeleteOnError() const { return false; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue