Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Mar 2004 12:49:27 +0100
From:      Oliver Eikemeier <eikemeier@fillmore-labs.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/64327: [PATCH] make(1): document surprising behaviour of assign with expansion
Message-ID:  <4056E9C7.10903@fillmore-labs.com>
Resent-Message-ID: <200403161150.i2GBoCmC086804@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         64327
>Category:       bin
>Synopsis:       [PATCH] make(1): document surprising behaviour of assign with expansion
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 16 03:50:11 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Eikemeier
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
Fillmore Labs - http://www.fillmore-labs.com
>Environment:
System: FreeBSD nuuk.fillmore-labs.com 4.9-STABLE

>Description:

Document a surprising behaviour of make(1)s assign with expansion
operator, that is apparently inteded but had bitten my at least once.

>How-To-Repeat:

Try the Makefile from the patch:

VAR1:=	Assigned with${OUT} expansion
VAR2!=	echo Assigned with${OUT} expansion
OUT=	out
all:
	@echo := - ${VAR1}
	@echo != - ${VAR2}

>Fix:

diff -u -r1.29.2.15 make.1
--- make.1	17 Dec 2002 19:01:18 -0000	1.29.2.15
+++ make.1	16 Mar 2004 11:12:09 -0000
@@ -1266,6 +1266,17 @@
 \&.endfor
 .Ed
 won't work, and should be rewritten the other way around.
+.Pp
+Undefined variables are not expanded when assigned with expansion.
+This is intentional, but may lead to surprising results:
+.Bd -literal
+VAR1:=  Assigned with${OUT} expansion
+VAR2!=  echo Assigned with${OUT} expansion
+OUT=    out
+all:
+    @echo := - ${VAR1}
+    @echo != - ${VAR2}
+.Ed
 .Sh SEE ALSO
 .Xr mkdep 1 ,
 .Xr make.conf 5

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4056E9C7.10903>