bug-make
[Top][All Lists]
Advanced

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

Re: [bug #51434] Document that variables are treated differently in prer


From: Edward Welbourne
Subject: Re: [bug #51434] Document that variables are treated differently in prerequisite lists and recipes
Date: Tue, 11 Jul 2017 08:05:56 +0000

> VARS=a.c b.c
>
> p: $(VARS)
>       echo i am using  $(VARS) to build
>       echo $(VARS) > p
>
> VARS=x.c y.c
>
> Here $(VARS) in the prerequisite list is expanded when make reads that
> line of the file (to "a.c b.c") but the $(VARS) in the recipe on the
> next line is expanded to its value at the end of the makefile (here
> "x.c y.c")

... which is a good reason for using $^ in the rule (it'll be the full
list of prerequisites, so match what $(VARS) was when the rule was
parsed); another thing worth mentioning in your proposed documentation
revision.

        Eddy.



reply via email to

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