]> git.tuebingen.mpg.de Git - lopsub.git/commitdiff
build: Activate .DELETE_ON_ERROR.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 25 Apr 2021 22:17:37 +0000 (00:17 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 28 Apr 2021 21:15:33 +0000 (23:15 +0200)
Since m4 lacks the -o option to specify an output file, we redirect
stdout in several recipes, in particular in the recipe that creates
lopsub.h from lopsub.h.m4. If the m4 command fails, lopsub.h will
be incomplete or empty, yet it will be considered as up-to-date
by make(1).

This patch teaches make(1) to remove such incomplete output files
on errors.

Makefile

index c0057a38b89119897044caa0a1eaa705877989ca..31c2102a940a2ec372f78d5906e9da48852d6fc7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,13 @@ endif
 .ONESHELL:
 .SHELLFLAGS := -ec
 
+# Recipes which redirect stdout to the target of the rule (i.e., constructs
+# like cmd > $@) create empty or incomplete output files if the command fails,
+# for example when cmd was not found. Since the target exists and is uptodate
+# in this case, this may lead to all sorts of problems. The following target
+# makes sure that such files are removed.
+.DELETE_ON_ERROR:
+
 PREFIX ?= /usr/local
 M4 := m4
 LN := ln -f