diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2023-02-06 14:50:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-06 14:50:06 -0500 |
commit | 675e296641468b7c4782e262705feffe58527606 (patch) | |
tree | 4dfc559881c1ba07c99c24fe3d409a1c5893d95a /template | |
parent | fa49651e05a06512e18ccb2f54a7198c9ff579de (diff) |
Add .DELETE_ON_ERROR to Makefile
This instructs make to delete target files if the recipe fails midway, like
when make itself is interrupted. This is mostly for development since it
protects against corrupt builds that need a `make clean` to repair. Release
builds normally don't fail mid-recipe.
GNU make and BSD make support this.
From GNU make's manual:
> This is almost always what you want make to do, but it is not historical
> practice; so for compatibility, you must explicitly request it.
See https://innolitics.com/articles/make-delete-on-error/
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5745
Merged-By: XrXr
Diffstat (limited to 'template')
-rw-r--r-- | template/Makefile.in | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/template/Makefile.in b/template/Makefile.in index 94f41181d5..71b68edbeb 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -294,6 +294,10 @@ all: # Prevent GNU make v3 from overflowing arg limit on SysV. .NOEXPORT: +# On GNU make and BSD make, clean up the target when the recipe +# fails. Prevents half-built targets corrupting future runs. +.DELETE_ON_ERROR: + miniruby$(EXEEXT): @-if test -f $@; then $(MV) -f $@ $@.old; $(RM) $@.old; fi $(ECHO) linking $@ |