help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help redirecting DOS command output to gmake environment


From: CHEN Cheng
Subject: Re: Help redirecting DOS command output to gmake environment
Date: Fri, 28 Aug 2009 11:25:07 +0800
User-agent: Mutt/1.5.17 (2007-11-01)

On Thu, Aug 27, 2009 at 04:05:35PM -0700, Varambally, Dheeraj B wrote:
> Hi,
> 
> I'm trying to execute a DOS perl script as part of the gmake rule and I would 
> like to redirect the text output of the perl script into a gmake variable 
> that will be used in the subsequent command in the same rule. Is there an 
> easy way to do it as I'm unable to access the text from gmake command.
> 
> Here is how my rule is supposed to look:
> Target : prereq
>               VAR:= $(shell  Perl myperl.pl )
>              $( CC)  prereq -D$(VAR)
> 
> 
> VAR:= $(shell  Perl myperl.pl ) is valid if executed outside the gmake rule 
> but I is there any equivalent way to achieve it in the gmake rule itself?
> 

Simply "VAR:=..." would be regarded as a shell command, but if you wrap
your variable assignment into `eval`, it works. Please see below:

VAR := 123

all: ttt
    echo $(VAR)

ttt: zzz
    echo ok $(eval VAR:=$(shell echo I am evil.))
    echo $(VAR)

zzz:
    echo VAR := $(VAR)


HTH,
Cheng




reply via email to

[Prev in Thread] Current Thread [Next in Thread]