Home | History | Annotate | Line # | Download | only in unit-tests
directive-ifdef.mk revision 1.4
      1  1.4  rillig # $NetBSD: directive-ifdef.mk,v 1.4 2021/01/21 23:03:41 rillig Exp $
      2  1.1  rillig #
      3  1.2  rillig # Tests for the .ifdef directive.
      4  1.1  rillig 
      5  1.1  rillig # TODO: Implementation
      6  1.1  rillig 
      7  1.3  rillig DEFINED=	defined
      8  1.3  rillig 
      9  1.3  rillig # It looks redundant to have a call to defined() in an .ifdef, but it's
     10  1.3  rillig # possible.  The .ifdef only affects plain symbols, not function calls.
     11  1.3  rillig .ifdef defined(DEFINED)
     12  1.3  rillig .  info Function calls in .ifdef are possible.
     13  1.3  rillig .else
     14  1.3  rillig .  error
     15  1.3  rillig .endif
     16  1.3  rillig 
     17  1.4  rillig # String literals are handled the same in all variants of the .if directive.
     18  1.4  rillig # They evaluate to true if they are not empty.  Whitespace counts as non-empty
     19  1.4  rillig # as well.
     20  1.4  rillig .ifdef ""
     21  1.4  rillig .  error
     22  1.4  rillig .else
     23  1.4  rillig .  info String literals are tested for emptiness.
     24  1.4  rillig .endif
     25  1.4  rillig 
     26  1.4  rillig .ifdef " "
     27  1.4  rillig .  info String literals are tested for emptiness.  Whitespace is non-empty.
     28  1.4  rillig .else
     29  1.4  rillig .  error
     30  1.4  rillig .endif
     31  1.4  rillig 
     32  1.1  rillig all:
     33  1.1  rillig 	@:;
     34