Home | History | Annotate | Line # | Download | only in unit-tests
cond-func-target.mk revision 1.5
      1 # $NetBSD: cond-func-target.mk,v 1.5 2025/01/10 23:00:38 rillig Exp $
      2 #
      3 # Tests for the target() function in .if conditions.
      4 
      5 .MAIN: all
      6 
      7 # The target "target" does not exist yet.
      8 .if target(target)
      9 .  error
     10 .endif
     11 
     12 target:
     13 
     14 # The target exists, even though it does not have any commands.
     15 .if !target(target)
     16 .  error
     17 .endif
     18 
     19 target:
     20 	# not a command
     21 
     22 # Adding a comment to an existing target does not change whether the target
     23 # is defined or not.
     24 .if !target(target)
     25 .  error
     26 .endif
     27 
     28 target:
     29 	@:;
     30 
     31 # Adding a command to an existing target does not change whether the target
     32 # is defined or not.
     33 .if !target(target)
     34 .  error
     35 .endif
     36 
     37 # Expressions in the argument of a function call don't have to be defined.
     38 .if target(${UNDEF})
     39 .  error
     40 .endif
     41 
     42 all:
     43 	@:;
     44