Home | History | Annotate | Line # | Download | only in unit-tests
cond-token-var.mk revision 1.4
      1 # $NetBSD: cond-token-var.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $
      2 #
      3 # Tests for variables in .if conditions.
      4 
      5 DEF=	defined
      6 
      7 # A defined variable may appear on either side of the comparison.
      8 .if ${DEF} == ${DEF}
      9 .  info ok
     10 .else
     11 .  error
     12 .endif
     13 
     14 # A variable that appears on the left-hand side must be defined.
     15 .if ${UNDEF} == ${DEF}
     16 .  error
     17 .endif
     18 
     19 # A variable that appears on the right-hand side must be defined.
     20 .if ${DEF} == ${UNDEF}
     21 .  error
     22 .endif
     23 
     24 # A defined variable may appear as an expression of its own.
     25 .if ${DEF}
     26 .endif
     27 
     28 # An undefined variable generates a warning.
     29 .if ${UNDEF}
     30 .endif
     31 
     32 # The :U modifier turns an undefined variable into an ordinary expression.
     33 .if ${UNDEF:U}
     34 .endif
     35