Home | History | Annotate | Line # | Download | only in unit-tests
varname-dot-newline.mk revision 1.3
      1  1.3  rillig # $NetBSD: varname-dot-newline.mk,v 1.3 2020/08/19 05:51:18 rillig Exp $
      2  1.1  rillig #
      3  1.2  rillig # Tests for the special .newline variable.
      4  1.3  rillig #
      5  1.3  rillig # Contrary to the special variable named "" that is used in expressions like
      6  1.3  rillig # ${:Usome-value}, the variable ".newline" is not protected against
      7  1.3  rillig # modification.  Nobody exploits that though.
      8  1.3  rillig 
      9  1.3  rillig NEWLINE:=	${.newline}
     10  1.3  rillig 
     11  1.3  rillig .newline=	overwritten
     12  1.3  rillig 
     13  1.3  rillig .if ${.newline} == ${NEWLINE}
     14  1.3  rillig .info The .newline variable cannot be overwritten.  Good.
     15  1.3  rillig .else
     16  1.3  rillig .info The .newline variable can be overwritten.  Just don't do that.
     17  1.3  rillig .endif
     18  1.1  rillig 
     19  1.3  rillig # Restore the original value.
     20  1.3  rillig .newline=	${NEWLINE}
     21  1.1  rillig 
     22  1.1  rillig all:
     23  1.3  rillig 	@echo 'first${.newline}second'
     24