11.5Srillig# $NetBSD: compat-error.mk,v 1.5 2022/05/08 06:51:27 rillig Exp $
21.1Srillig#
31.1Srillig# Test detailed error handling in compat mode.
41.1Srillig#
51.5Srillig# Make several targets that alternately succeed and fail.
61.1Srillig#
71.5Srillig# The first failing top-level target is recorded in '.ERROR_TARGET'.  While
81.5Srillig# this information may give a hint as to which target failed, it would be more
91.5Srillig# useful at that point to know the actual target that failed, or the complete
101.5Srillig# chain from root cause to top-level target.
111.5Srillig#
121.5Srillig# Historic bugs
131.5Srillig#	Before compat.c 1.215 from 2020-12-13, '.ERROR_TARGET' was 'success3',
141.5Srillig#	which was obviously wrong.
151.5Srillig#
161.5Srillig# Bugs
171.5Srillig#	As of 2020-12-13, '.ERROR_CMD' is empty, which does not provide any
181.5Srillig#	insight into the command that actually failed.
191.1Srillig#
201.1Srillig# See also:
211.4Srillig#	Compat_MakeAll
221.1Srillig#
231.1Srillig#	The commit that added the NULL command to gn->commands:
241.1Srillig#		CVS: 1994.06.06.22.45.??
251.1Srillig#		Git: 26a8972fd7f982502c5fbfdabd34578b99d77ca5
261.1Srillig#		1994: Lst_Replace (cmdNode, (ClientData) NULL);
271.1Srillig#		2020: LstNode_SetNull(cmdNode);
281.1Srillig#
291.1Srillig#	The commit that skipped NULL commands for .ERROR_CMD:
301.5Srillig#		CVS: 2016.08.11.19.53.17
311.1Srillig#		Git: 58b23478b7353d46457089e726b07a49197388e4
321.1Srillig
331.5Srillig.MAKEFLAGS: -k success1 fail1 success2 fail2 success3
341.1Srillig
351.1Srilligsuccess1 success2 success3:
361.1Srillig	: Making ${.TARGET} out of nothing.
371.1Srillig
381.1Srilligfail1 fail2:
391.1Srillig	: Making ${.TARGET} out of nothing.
401.2Srillig	false '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}'
411.1Srillig
421.1Srillig.ERROR:
431.2Srillig	@echo ${.TARGET} target: '<'${.ERROR_TARGET:Q}'>'
441.2Srillig	@echo ${.TARGET} command: '<'${.ERROR_CMD:Q}'>'
45