help-make
[Top][All Lists]
Advanced

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

simple question about variables in a rule


From: Robert P. J. Day
Subject: simple question about variables in a rule
Date: Sun, 16 May 2004 06:51:43 -0400 (EDT)

  currently, i have a rule that i expect to invoke with a couple variables
from the command line -- call them A and B:

$ make A=somevalue B=someothervalue target

and the makefile will have the target:

target:
        @echo "A = $A"
        @echo "B = $B"
        ... rest of rule ...

now, for efficiency, i'll always use these variables as "${A}/${B}", so i 
just want to temporarily set that value to, say, C (and *only* within the
scope of this rule):

target:
        @echo "A = $A"
        @echo "B = $B"
        C=${A}/${B}

and i can see that C is, in fact, being set to the appropriate value.  but
how do i use that value of C in the rest of the commands in the rule?  
i've tried variations of $C, $$C and so on.  what painfully obvious 
variation am i missing so that the variable C is available only for the 
rest of this rule?

rday





reply via email to

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