help-make
[Top][All Lists]
Advanced

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

Re: Trouble with make


From: Sam Ravnborg
Subject: Re: Trouble with make
Date: Sat, 26 Jun 2010 12:55:32 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

On Sat, Jun 26, 2010 at 02:22:19AM -0700, Ranjana wrote:
> I have the following snippet in my makefile
>  
> export LEC_RUN = $@
> 
> all: ; @echo Target is $(LEC_RUN)
> 
> ifeq "$(LEC_RUN)" "lec_rtl_vs_pc"
>   export STDCELL_MAIN_NON_TIMING_V = 
> /pkg/hwlibraries/gates/q55gl/2007.09/src/verilog/non-timing/q55gl.v 
> else
>   export STDCELL_MAIN_NON_TIMING_V = 
> /iceng/lib/q55gl/2007.09/synopsys/lib/tsmcn65lp/UPF/verilog/non-timing/q55gl.v
> endif
> 
> The target print is lec_rtl_vs_pc however 
> 
> But it goes in the else statement and picks the wrong library..

A few things you should understand.
The value of LEC_RUN is evaluated when you reference the variable - because you 
used "=".
So when you reference LEC_RUN as part of your command there is a target thus $@ 
is set.
This explains why it prints out the target name.

But you also reference LEC_RUN outside the command in the ifeq part.
And here there is no target defined. Actually this part is parsed
and executed by make in the first parse of the makefile IIRC.
This is why you see that it always hit the else part.

You can never reference $@ direct or indirect outside the command part of a 
makefile.

Based on your Makefile snip I do not have any proposals how to solve
your problem.

        Sam



reply via email to

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