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