help-make
[Top][All Lists]
Advanced

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

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


From: Sam Ravnborg
Subject: Re: Need some information related setting make variables during run-time depending on the target
Date: Wed, 28 Jul 2010 17:44:08 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

On Wed, Jul 28, 2010 at 08:46:26PM +0530, Sandeep K S wrote:
> Hello Make Experts,
> 
>  I need some information on Makefiles with respect to setting some  make
> variables during run time depending on the target.
> 
> For eg:
> 
> I have two targets A and B. For Target A, I need to set a variable FLAG as
> '-DFLAG_A', and for target B, I need to set the variable FLAG as '-DFLAG_B'.
> This FLAG variable is used in the compilation which declares two macros
> (FLAG_A and FLAG_B) for the C file to use.

It is as simple as this (if I understood your mail correct):

--------
A: FLAG = -DFLAG_A
B: FLAG = -DFLAG_B


A:
        @echo $(FLAG)

B:
        @echo $(FLAG)
-----

The two rules shows that it works if you try the Makefile. 

        Sam



reply via email to

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