Home | History | Annotate | Line # | Download | only in unit-tests
cond-func-commands.mk revision 1.3
      1  1.3  rillig # $NetBSD: cond-func-commands.mk,v 1.3 2020/08/23 14:07:20 rillig Exp $
      2  1.1  rillig #
      3  1.2  rillig # Tests for the commands() function in .if conditions.
      4  1.1  rillig 
      5  1.3  rillig .MAIN: all
      6  1.3  rillig 
      7  1.3  rillig # The target "target" does not exist yet, therefore it cannot have commands.
      8  1.3  rillig .if commands(target)
      9  1.3  rillig .error
     10  1.3  rillig .endif
     11  1.3  rillig 
     12  1.3  rillig target:
     13  1.3  rillig 
     14  1.3  rillig # Now the target exists, but it still has no commands.
     15  1.3  rillig .if commands(target)
     16  1.3  rillig .error
     17  1.3  rillig .endif
     18  1.3  rillig 
     19  1.3  rillig target:
     20  1.3  rillig 	# not a command
     21  1.3  rillig 
     22  1.3  rillig # Even after the comment, the target still has no commands.
     23  1.3  rillig .if commands(target)
     24  1.3  rillig .error
     25  1.3  rillig .endif
     26  1.3  rillig 
     27  1.3  rillig target:
     28  1.3  rillig 	@:;
     29  1.3  rillig 
     30  1.3  rillig # Finally the target has commands.
     31  1.3  rillig .if !commands(target)
     32  1.3  rillig .error
     33  1.3  rillig .endif
     34  1.1  rillig 
     35  1.1  rillig all:
     36  1.1  rillig 	@:;
     37