blob: 70a9cd0b590bf5211376f9c39505efa8d323e152 (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# $NetBSD: deptgt-makeflags.mk,v 1.4 2020/10/23 14:48:49 rillig Exp $
#
# Tests for the special target .MAKEFLAGS in dependency declarations,
# which adds command line options later, at parse time.
# The -D option sets a variable in the "Global" scope and thus can be
# undefined later.
.MAKEFLAGS: -D VAR
.if ${VAR} != 1
. error
.endif
.undef VAR
.if defined(VAR)
. error
.endif
.MAKEFLAGS: -D VAR
.if ${VAR} != 1
. error
.endif
.MAKEFLAGS: VAR="value"' with'\ spaces
.if ${VAR} != "value with spaces"
. error
.endif
# Variables set on the command line as VAR=value are placed in the
# "Command" scope and thus cannot be undefined.
.undef VAR
.if ${VAR} != "value with spaces"
. error
.endif
# When parsing this line, each '$$' becomes '$', resulting in '$$$$'.
# This is assigned to the variable DOLLAR.
# In the condition, that variable is expanded, and at that point, each '$$'
# becomes '$' again, the final expression is thus '$$'.
.MAKEFLAGS: -dcv
.MAKEFLAGS: DOLLAR=$$$$$$$$
.if ${DOLLAR} != "\$\$"
.endif
.MAKEFLAGS: -d0
all:
@:;
|