Home | History | Annotate | Line # | Download | only in unit-tests
deptgt-makeflags.mk revision 1.4
      1  1.4  rillig # $NetBSD: deptgt-makeflags.mk,v 1.4 2020/10/23 14:48:49 rillig Exp $
      2  1.1  rillig #
      3  1.3  rillig # Tests for the special target .MAKEFLAGS in dependency declarations,
      4  1.3  rillig # which adds command line options later, at parse time.
      5  1.1  rillig 
      6  1.3  rillig # The -D option sets a variable in the "Global" scope and thus can be
      7  1.3  rillig # undefined later.
      8  1.3  rillig .MAKEFLAGS: -D VAR
      9  1.3  rillig 
     10  1.3  rillig .if ${VAR} != 1
     11  1.3  rillig .  error
     12  1.3  rillig .endif
     13  1.3  rillig 
     14  1.3  rillig .undef VAR
     15  1.3  rillig 
     16  1.3  rillig .if defined(VAR)
     17  1.3  rillig .  error
     18  1.3  rillig .endif
     19  1.3  rillig 
     20  1.3  rillig .MAKEFLAGS: -D VAR
     21  1.3  rillig 
     22  1.3  rillig .if ${VAR} != 1
     23  1.3  rillig .  error
     24  1.3  rillig .endif
     25  1.3  rillig 
     26  1.3  rillig .MAKEFLAGS: VAR="value"' with'\ spaces
     27  1.3  rillig 
     28  1.3  rillig .if ${VAR} != "value with spaces"
     29  1.3  rillig .  error
     30  1.3  rillig .endif
     31  1.3  rillig 
     32  1.3  rillig # Variables set on the command line as VAR=value are placed in the
     33  1.3  rillig # "Command" scope and thus cannot be undefined.
     34  1.3  rillig .undef VAR
     35  1.3  rillig 
     36  1.3  rillig .if ${VAR} != "value with spaces"
     37  1.3  rillig .  error
     38  1.3  rillig .endif
     39  1.1  rillig 
     40  1.4  rillig # When parsing this line, each '$$' becomes '$', resulting in '$$$$'.
     41  1.4  rillig # This is assigned to the variable DOLLAR.
     42  1.4  rillig # In the condition, that variable is expanded, and at that point, each '$$'
     43  1.4  rillig # becomes '$' again, the final expression is thus '$$'.
     44  1.4  rillig .MAKEFLAGS: -dcv
     45  1.4  rillig .MAKEFLAGS: DOLLAR=$$$$$$$$
     46  1.4  rillig .if ${DOLLAR} != "\$\$"
     47  1.4  rillig .endif
     48  1.4  rillig .MAKEFLAGS: -d0
     49  1.4  rillig 
     50  1.1  rillig all:
     51  1.1  rillig 	@:;
     52