Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Oct 2009 13:26:20 GMT
From:      FUCHIGAMI Masachika <masatic@mbs.sphere.ne.jp>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/139601: make(1): variable substitution for $@ in dependency source fails
Message-ID:  <200910141326.n9EDQK4Z098630@www.freebsd.org>
Resent-Message-ID: <200910141330.n9EDU220026280@freefall.freebsd.org>

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

>Number:         139601
>Category:       bin
>Synopsis:       make(1): variable substitution for $@ in dependency source fails
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 14 13:30:02 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     FUCHIGAMI Masachika
>Release:        FreeBSD 7.0-RELEASE i386
>Organization:
>Environment:
FreeBSD inca 7.0-RELEASE FreeBSD 7.0-RELEASE #15: Tue Aug 25 08:58:13 JST 2009 root@inca:/usr/src/sys/i386/compile/INCA i386

>Description:
local variable substitution in dependency source fails when $@ is used in another variable name ( e.g. ${$(@)_SRC} ).

make(1) delayes load-time variable substitution for local variables by expanding local variables to itself ( $@ -> $@ ), but make(1) does not delay variables containing local variables.

>How-To-Repeat:
-- Makefile
foo=bar
foo: $($@).txt
--
% touch bar.txt
% make foo
make: don't know how to make .txt. Stop

>Fix:
*** var.c	2006-07-18 06:05:27.000000000 +0900
--- var.c	2009-10-14 21:43:55.000000000 +0900
***************
*** 1924,1929 ****
--- 1924,1937 ----
  				return (value);
  			}
  		}
+ 		if( vlen >=1 && strchr( vname, '$' ) != NULL ) {
+ 			value = emalloc( consumed + 1 );
+ 			strncpy(value, vp->input, consumed);
+ 			value[consumed] = '\0';
+ 
+ 			*freeResult = TRUE;
+ 			return (value);
+ 		}
  
  		*freeResult = FALSE;
  		return (vp->err ? var_Error : varNoError);
***************
*** 2019,2024 ****
--- 2027,2040 ----
  				return (value);
  			}
  		}
+ 		if( vlen >=1 && strchr( vname, '$' ) != NULL ) {
+ 			value = emalloc( consumed + 1 );
+ 			strncpy(value, vp->input, consumed);
+ 			value[consumed] = '\0';
+ 
+ 			*freeResult = TRUE;
+ 			return (value);
+ 		}
  	} else {
  		/*
  		 * Check for D and F forms of local variables since we're in

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



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