xref: /freebsd/contrib/bmake/unit-tests/directive-elifndef.mk (revision 9f45a3c8c82ffead7044ae836d9257113c630d3b)
1*9f45a3c8SSimon J. Gerraty# $NetBSD: directive-elifndef.mk,v 1.3 2022/01/22 21:50:41 rillig Exp $
22c3632d1SSimon J. Gerraty#
3*9f45a3c8SSimon J. Gerraty# Tests for the .elifndef directive, which is an obscure form of writing the
4*9f45a3c8SSimon J. Gerraty# more usual '.elif !defined(VAR)'.
52c3632d1SSimon J. Gerraty
6*9f45a3c8SSimon J. Gerraty# At this point, VAR is not yet defined, and due to the 'n' in 'elifndef' the
7*9f45a3c8SSimon J. Gerraty# condition evaluates to true.
8*9f45a3c8SSimon J. Gerraty.if 0
9*9f45a3c8SSimon J. Gerraty.elifndef VAR && VAR || VAR
10*9f45a3c8SSimon J. Gerraty.else
11*9f45a3c8SSimon J. Gerraty.  error
12*9f45a3c8SSimon J. Gerraty.endif
13*9f45a3c8SSimon J. Gerraty
14*9f45a3c8SSimon J. GerratyVAR=	# defined
15*9f45a3c8SSimon J. Gerraty
16*9f45a3c8SSimon J. Gerraty# At this point, VAR is defined, and due to the 'n' in 'elifndef' the
17*9f45a3c8SSimon J. Gerraty# condition evaluates to false.
18*9f45a3c8SSimon J. Gerraty.if 0
19*9f45a3c8SSimon J. Gerraty.elifndef VAR && VAR || VAR
20*9f45a3c8SSimon J. Gerraty.  error
21*9f45a3c8SSimon J. Gerraty.endif
222c3632d1SSimon J. Gerraty
232c3632d1SSimon J. Gerratyall:
24