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