Home | History | Annotate | Line # | Download | only in unit-tests
deptgt-makeflags.mk revision 1.3
      1 # $NetBSD: deptgt-makeflags.mk,v 1.3 2020/09/10 21:22:07 rillig Exp $
      2 #
      3 # Tests for the special target .MAKEFLAGS in dependency declarations,
      4 # which adds command line options later, at parse time.
      5 
      6 # The -D option sets a variable in the "Global" scope and thus can be
      7 # undefined later.
      8 .MAKEFLAGS: -D VAR
      9 
     10 .if ${VAR} != 1
     11 .  error
     12 .endif
     13 
     14 .undef VAR
     15 
     16 .if defined(VAR)
     17 .  error
     18 .endif
     19 
     20 .MAKEFLAGS: -D VAR
     21 
     22 .if ${VAR} != 1
     23 .  error
     24 .endif
     25 
     26 .MAKEFLAGS: VAR="value"' with'\ spaces
     27 
     28 .if ${VAR} != "value with spaces"
     29 .  error
     30 .endif
     31 
     32 # Variables set on the command line as VAR=value are placed in the
     33 # "Command" scope and thus cannot be undefined.
     34 .undef VAR
     35 
     36 .if ${VAR} != "value with spaces"
     37 .  error
     38 .endif
     39 
     40 all:
     41 	@:;
     42