blob: 28f835fa3cbda49b2dc1c103440e0cbcb8129a1b (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# $NetBSD: cond-op-not.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $
#
# Tests for the ! operator in .if conditions, which negates its argument.
# The exclamation mark negates its operand.
.if !1
. error
.endif
# Exclamation marks can be chained.
# This doesn't happen in practice though.
.if !!!1
. error
.endif
# The ! binds more tightly than the &&.
.if !!0 && 1
. error
.endif
# The operator '==' binds more tightly than '!'.
# This is unusual since most other programming languages define the precedence
# to be the other way round.
.if !${:Uexpression} == "expression"
. error
.endif
.if !${:U}
# expect+1: Not empty evaluates to true.
. info Not empty evaluates to true.
.else
. info Not empty evaluates to false.
.endif
.if !${:U }
. info Not space evaluates to true.
.else
# expect+1: Not space evaluates to false.
. info Not space evaluates to false.
.endif
.if !${:U0}
# expect+1: Not 0 evaluates to true.
. info Not 0 evaluates to true.
.else
. info Not 0 evaluates to false.
.endif
.if !${:U1}
. info Not 1 evaluates to true.
.else
# expect+1: Not 1 evaluates to false.
. info Not 1 evaluates to false.
.endif
.if !${:Uword}
. info Not word evaluates to true.
.else
# expect+1: Not word evaluates to false.
. info Not word evaluates to false.
.endif
# A single exclamation mark is a parse error.
# expect+1: Malformed conditional (!)
.if !
. error
.else
. error
.endif
all:
@:;
|