help-make
[Top][All Lists]
Advanced

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

Re: pattern rule prerequisites?


From: Andre Merzky
Subject: Re: pattern rule prerequisites?
Date: Fri, 9 Aug 2002 03:30:49 +0200
User-agent: Mutt/1.2.5.1i

I have seen some similar quesion in the mailing list archive.  There
was an answer:

"All you can do is use either a submake, or included makefile where
 you have a rule that constructs the makefile.  In the latter case,
 if the makefile to be included either doesn't exist or is
 out-of-date then make will re-build it then re-exec itself."


I am probably not experienced enough to understand these options.  I
tried the following (not same example as before...):

-------------------------------------------
$(bins): % : .bins_%_objs.d
include .bins_$*_objs.d
              $(CC) -o $@ $<

.bins_%_objs.d:
              echo $*: $($*_objs) >> $@
-------------------------------------------

or

-------------------------------------------
$(bins): % : .bins_%_objs.d
              include .bins_$*_objs.d
              $(CC) -o $@ $<

.bins_%_objs.d:
              echo $*: $($*_objs) >> $@
-------------------------------------------

the first failes because .bins__objs.d does not exist, so $* is not
known when makefiles are included.  The second one failes,
naturally, because include is interpreted as shell command.

So, what was meant with the answer above? ;-)

Cheers, Andre.

On Fri, Aug 09, 2002 at 03:03:27AM +0200, Andre Merzky wrote:
> 
> Hi, 
> 
> trying to get used to the pattern rules, I met following problem:
> 
> libs = liba.so
> liba_objs = a1.o a2.o a3.o
> 
> lib%.so:
>       ld -shared -o $@ $(lib$*_objs)
> 
> 
> That looks like what I wont (dont ask why ;-), but now of course I
> would like to specify the liba_objs as prerequisites to the lib%.so
> pattern.  How do I do that?  Following seems to fail:
> 
> lib%.so: $(lib%_objs)
>         ld -shared -o $@ $(lib$*_objs)
> 
> As far as I understand the pattern match is done _after_ _all_ vars
> and functions are expanded - so $(...) just gets not expandeda after
> the match.  
> 
> This also fails:
> 
> lib%.so: $(lib$*_objs)
>           ld -shared -o $@ $(lib$*_objs)
> 
> probably for the same reason ;-)
> 
> Thanks for any hint, 
> 
>   Andre.
> 
> 
> -- 
> +------------------------------------------------------------------+
> | Andre Merzky                   | phon: ++49 - 30 - 84 1 85 - 339 |
> | Zuse Institute Berlin (ZIB)    | fax : ++49 - 30 - 84 1 85 - 107 |
> | - Scientific Visualization -   | mail: address@hidden             |
> | Takustr. 7 - D-14195 Berlin    | www : http://www.zib.de/merzky/ |
> +------------------------------------------------------------------+



-- 
+------------------------------------------------------------------+
| Andre Merzky                   | phon: ++49 - 30 - 84 1 85 - 339 |
| Zuse Institute Berlin (ZIB)    | fax : ++49 - 30 - 84 1 85 - 107 |
| - Scientific Visualization -   | mail: address@hidden             |
| Takustr. 7 - D-14195 Berlin    | www : http://www.zib.de/merzky/ |
+------------------------------------------------------------------+



reply via email to

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