From 675e296641468b7c4782e262705feffe58527606 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Mon, 6 Feb 2023 14:50:06 -0500 Subject: 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/ --- template/Makefile.in | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'template') 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 $@ -- cgit v1.2.1