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