[Top][All Lists]

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

Re: Need some information related setting make variables during run-tim

From: Paul Smith
Subject: Re: Need some information related setting make variables during run-time depending on the target
Date: Fri, 30 Jul 2010 11:16:36 -0400

On Fri, 2010-07-30 at 09:47 +0530, Sandeep K S wrote:
> However, the Target-specific variable has an internal characteristics
> that the make variables used for compiling a file would be retained
> untill the file is recompiled again. SO this will be used across
> building multiple targets, if the same source file is used by these
> targets and they are not re-compiled.
> So in my case, I built target A with FLAG_A. However, immediately
> after this if I try to build Target B, the FLAG_A continues, as there
> is no change to the source file, and this source file is common
> between targets A and B.

Please remember to CC the mailing list, so others can help.

I don't really understand your comments above.  A target-specific
variable has nothing to do with the source file.  It's a variable
attached to the TARGET, not the prerequisites.

So, if you have two different targets that are built from the same
source file, each target has its own instance of the target-specific
variable.  For example:

        all: foo.o bar.o

        foo.o:  VAR=one
        foo.o:  blah.c   ; @echo $@: $^ with $(VAR)

        bar.o:  VAR=two
        bar.o   blah.c   ; @echo $@: $^ with $(VAR)

you will see that each invocation uses its own value of VAR.

If this isn't what you mean, can you provide a small example showing the
issue you're having?  Examples like this are significantly easier to
read and understand than long textual descriptions.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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