make(1): don't make .END if the main targets already failed
This only applies to -k mode. By default, make exits earlier and skips the .END node as well if an error occurs.
This commit is contained in:
parent
e48e1a2882
commit
ea51e814f2
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: compat.c,v 1.199 2020/12/07 00:53:30 rillig Exp $ */
|
||||
/* $NetBSD: compat.c,v 1.200 2020/12/07 01:04:06 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -96,7 +96,7 @@
|
|||
#include "pathnames.h"
|
||||
|
||||
/* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */
|
||||
MAKE_RCSID("$NetBSD: compat.c,v 1.199 2020/12/07 00:53:30 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: compat.c,v 1.200 2020/12/07 01:04:06 rillig Exp $");
|
||||
|
||||
static GNode *curTarg = NULL;
|
||||
static pid_t compatChild;
|
||||
|
@ -729,7 +729,7 @@ Compat_Run(GNodeList *targs)
|
|||
/*
|
||||
* If the user has defined a .END target, run its commands.
|
||||
*/
|
||||
if (!mainDepError) {
|
||||
if (!mainError && !mainDepError) {
|
||||
GNode *endNode = Targ_GetEndNode();
|
||||
Compat_Make(endNode, endNode);
|
||||
endError = GNode_IsError(endNode);
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
: Making all out of nothing.
|
||||
false
|
||||
*** Error code 1 (continuing)
|
||||
: Making .END out of nothing.
|
||||
false
|
||||
*** Error code 1 (continuing)
|
||||
|
||||
Stop.
|
||||
make: stopped in unit-tests
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
# $NetBSD: deptgt-end-fail-all.mk,v 1.1 2020/12/06 21:22:04 rillig Exp $
|
||||
# $NetBSD: deptgt-end-fail-all.mk,v 1.2 2020/12/07 01:04:07 rillig Exp $
|
||||
#
|
||||
# Test whether the commands from the .END target are run even if there is
|
||||
# an error before. The manual page says "after everything else is done",
|
||||
# which leaves room for interpretation.
|
||||
#
|
||||
# Until 2020-12-07, the .END node was made even if the main nodes had failed.
|
||||
# This was not intended since the .END node had already been skipped if a
|
||||
# dependency of the main nodes had failed, just not if one of the main nodes
|
||||
# themselves had failed. This inconsistency was not worth keeping. To run
|
||||
# some commands on error, use the .ERROR target instead, see deptgt-error.mk.
|
||||
|
||||
all: .PHONY
|
||||
: Making ${.TARGET} out of nothing.
|
||||
|
|
|
@ -84,8 +84,6 @@ Test case all=ERR all-dep=ok end=ok end-dep=ok.
|
|||
: Making all-dep out of nothing.
|
||||
: Making all from all-dep.
|
||||
*** Error code 1 (continuing)
|
||||
: Making end-dep out of nothing.
|
||||
: Making .END from end-dep.
|
||||
|
||||
Stop.
|
||||
make: stopped in unit-tests
|
||||
|
@ -96,8 +94,6 @@ Test case all=ERR all-dep=ok end=ok end-dep=ERR.
|
|||
: Making all-dep out of nothing.
|
||||
: Making all from all-dep.
|
||||
*** Error code 1 (continuing)
|
||||
: Making end-dep out of nothing.
|
||||
*** Error code 1 (continuing)
|
||||
|
||||
Stop.
|
||||
make: stopped in unit-tests
|
||||
|
@ -108,9 +104,6 @@ Test case all=ERR all-dep=ok end=ERR end-dep=ok.
|
|||
: Making all-dep out of nothing.
|
||||
: Making all from all-dep.
|
||||
*** Error code 1 (continuing)
|
||||
: Making end-dep out of nothing.
|
||||
: Making .END from end-dep.
|
||||
*** Error code 1 (continuing)
|
||||
|
||||
Stop.
|
||||
make: stopped in unit-tests
|
||||
|
@ -121,8 +114,6 @@ Test case all=ERR all-dep=ok end=ERR end-dep=ERR.
|
|||
: Making all-dep out of nothing.
|
||||
: Making all from all-dep.
|
||||
*** Error code 1 (continuing)
|
||||
: Making end-dep out of nothing.
|
||||
*** Error code 1 (continuing)
|
||||
|
||||
Stop.
|
||||
make: stopped in unit-tests
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: deptgt-end-fail.mk,v 1.5 2020/12/07 00:53:30 rillig Exp $
|
||||
# $NetBSD: deptgt-end-fail.mk,v 1.6 2020/12/07 01:04:07 rillig Exp $
|
||||
#
|
||||
# Tests for an errors in the main target, its dependencies,
|
||||
# the .END node and its dependencies.
|
||||
|
@ -63,5 +63,7 @@ end-dep:
|
|||
# because of errors.", followed by "exit status 0", which contradicted
|
||||
# each other.
|
||||
|
||||
# XXX: As of 2020-12-06, '.END' is made if 'all' fails, but if a dependency
|
||||
# of 'all' fails, it is skipped. This is inconsistent.
|
||||
# Until 2020-12-07, '.END' was even made if 'all' failed, but if a dependency
|
||||
# of 'all' failed, it was skipped. This inconsistency was not needed for
|
||||
# anything and thus has been dropped. To run some commands on error, use the
|
||||
# .ERROR target instead, see deptgt-error.mk.
|
||||
|
|
Loading…
Reference in New Issue