aboutsummaryrefslogtreecommitdiffstats
path: root/template
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-02-06 14:50:06 -0500
committerGitHub <noreply@github.com>2023-02-06 14:50:06 -0500
commit675e296641468b7c4782e262705feffe58527606 (patch)
tree4dfc559881c1ba07c99c24fe3d409a1c5893d95a /template
parentfa49651e05a06512e18ccb2f54a7198c9ff579de (diff)
downloadruby-675e296641468b7c4782e262705feffe58527606.tar.gz
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/
Diffstat (limited to 'template')
-rw-r--r--template/Makefile.in4
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 $@