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.
.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