help-make
[Top][All Lists]
Advanced

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

Re: 6 How to Use Variables


From: Philip Guenther
Subject: Re: 6 How to Use Variables
Date: Sat, 19 Feb 2011 21:41:15 -0800

On Sat, Feb 19, 2011 at 8:01 PM, ali hagigat <address@hidden> wrote:
> "Variables and functions in all parts of a makefile are expanded when
> read, except for
> in recipes,.."
> Variables are not expanded in recipes?

Yes, variables are expanded in recipes; no, variables are not expanded
in recipes WHEN READ.  For example,

$ cat Makefile
var2=before
e12:
        echo $(var2)
var2=after
$ make
echo after
after
$

If $(var2) was expanded when the recipe was read, then it would have
been expanded to "before", but it wasn't.  It's only expanded later,
when the recipe is *executed*.

You're looking at chapter 6; go back and read chapter 3.7, "How `make'
Reads a Makefile", again.


Philip Guenther



reply via email to

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