aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/varname-dot-newline.mk
blob: 1940dc2a990d12664d97cce530bac8dbfe9ba350 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# $NetBSD: varname-dot-newline.mk,v 1.6 2023/01/26 20:48:18 sjg Exp $
#
# Tests for the special .newline variable, which contains a single newline
# character (U+000A).


# https://austingroupbugs.net/view.php?id=1549 proposes:
# > After all macro expansion is complete, when an escaped <newline> is
# > found in a command line in a makefile, the command line that is executed
# > shall contain the <backslash>, the <newline>, and the next line, except
# > that the first character of the next line shall not be included if it is
# > a <tab>.
#
# The above quote assumes that each resulting <newline> character has a "next
# line", but that's not how the .newline variable works.
BACKSLASH_NEWLINE:=	\${.newline}


# Check that .newline is read-only

NEWLINE:=	${.newline}

.newline=	overwritten

.if ${.newline} != ${NEWLINE}
.  error The .newline variable can be overwritten.  It should be read-only.
.endif

all:
	@echo 'first${.newline}second'
	@echo 'backslash newline: <${BACKSLASH_NEWLINE}>'