help-make
[Top][All Lists]
Advanced

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

RE: Automatic dependencies for linked libraries


From: Steve Deiters
Subject: RE: Automatic dependencies for linked libraries
Date: Thu, 25 Mar 2010 17:44:18 -0500

Thanks, I wasn't aware of the -llib syntax for the prerequisites.  Using
that certainly cleans stuff up for me.

I still have some junk in there to add the library paths to vpath.  I
haven't figured out a better way to make the colon delimited list.  I'm
left with something like this.


vpath lib% $(foreach d,$(patsubst -L%,%,$(filter -L%,$(LDFLAGS))),$(d):)
$(TARGET): $(filter -l%,$(LDFLAGS))


> -----Original Message-----
> From: Paul Smith [mailto:address@hidden 
> Sent: Thursday, March 25, 2010 5:08 PM
> To: Steve Deiters
> Cc: make-help mailing list
> Subject: RE: Automatic dependencies for linked libraries
> 
> On Thu, 2010-03-25 at 15:58 -0500, Steve Deiters wrote:
> > $(foreach d, $(patsubst -L%,%,$(filter -L%,$($(2)))),\  
> $(foreach l, 
> > $(patsubst -l%,%,$(filter -l%,$($(2)))),\
> >   $(if $(shell if [ -e $(d)/lib$(l).a ]; then echo "X"; fi),\
> 
> Actually now that I think about it you can probably avoid 
> this looping altogether and just gin up a complete list of 
> possible files and pass them all to wildcard at one time.
> 
> Well, I guess you'd need one list per source file, then use 
> $(firstword ...) on the results to be sure you got the right 
> one and only the right one; I think your version above 
> depends on all instances of libfoo.a, for example, rather 
> than just the one in the first directory.
> 
> 
> But, this all may be moot.  Have you looked into using the "-lfoo"
> format in the prerequisite lists, and setting .LIBPATTERNS?  
> Check out the section on "Directory Search for Link 
> Libraries" and see if that works for you.  If not, what's missing?
> 
> 
> Cheers!
> 
> --
> --------------------------------------------------------------
> -----------------
>  Paul D. Smith <address@hidden>          Find some GNU make tips at:
>  http://www.gnu.org                      http://make.mad-scientist.net
>  "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]