From c1840c5bb555ba09c09bdeb2f29305681038317f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 26 Apr 2021 00:17:37 +0200 Subject: [PATCH] build: Activate .DELETE_ON_ERROR. 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index c0057a3..31c2102 100644 --- 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 -- 2.39.5