xref: /freebsd/contrib/bmake/unit-tests/opt-debug-errors-jobs.mk (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
1# $NetBSD: opt-debug-errors-jobs.mk,v 1.2 2021/11/27 23:56:11 rillig Exp $
2#
3# Tests for the -de command line option, which adds debug logging for
4# failed commands and targets; since 2021-04-27 also in jobs mode.
5
6.MAKEFLAGS: -de -j1
7
8all: fail-spaces
9all: fail-escaped-space
10all: fail-newline
11all: fail-multiline
12all: fail-multiline-intention
13all: fail-vars
14
15fail-spaces:
16	echo '3   spaces'; false
17
18fail-escaped-space:
19	echo \  indented; false
20
21fail-newline:
22	echo 'line1${.newline}line2'; false
23
24# The line continuations in multiline commands are turned into an ordinary
25# space before the command is actually run.
26fail-multiline:
27	echo 'line1\
28		line2'; false
29
30# It is a common style to align the continuation backslashes at the right
31# of the lines, usually at column 73.  All spaces before the continuation
32# backslash are preserved and are usually outside a shell word and thus
33# irrelevant.  Since "usually" is not "always", these space characters are
34# not merged into a single space.
35fail-multiline-intention:
36	echo	'word1'							\
37		'word2'; false
38
39# In makefiles that rely heavily on abstracted variables, it is not possible
40# to determine the actual command from the unexpanded command alone. To help
41# debugging these issues (for example in NetBSD's build.sh), output the
42# expanded command as well whenever it differs from the unexpanded command.
43# Since 2021-11-28.
44COMPILE_C=	false c-compiler
45COMPILE_C_DEFS=	macro="several words"
46COMPILE_C_FLAGS=flag1 ${COMPILE_C_DEFS:@def@-${def}@}
47fail-vars:
48	@${COMPILE_C} ${COMPILE_C_FLAGS}
49