Re: {newbie question] dependencies on libraries

"John Williams" <[email protected]> Fri, 06 Feb 2004 09:42:29 -0600
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
On Fri, 06 Feb 2004 14:30:35 +0100, Bram Moolenaar wrote:
> Adding a shared library to the sources of a program is not supported.
> Should it work?
> 
> You can specify the dependency explicitly:
> 
> 	:dll dog : dog.cpp
> 	:program go1 
> 		{var_LIBS= -ldog }
> 		{var_LDFLAGS= -L. }
> 		:
> 		go1.cpp
> 	go1 : dog
> 
> Since you use "-ldog" this is more logical than adding "dog" as a source
> file.  Aap cannot know which "dog" library you want to link with (could
> be a system library), thus I don't think this should be done
> automatically.

I'm not sure I agree.  What about adding something like this at the end of
the recipe processing stage:

for each PROG defined in a ":program" command:
  for each DIR such that there is an -L$DIR flag in $PROG's $LIBS:
    for each LIB such that there an -l$LIB flag in $PROG's $LIBS:
      if there is a target defined for $DIR/$LIB:
        Add a dependency on $DIR/$LIB to $PROG.

This should automatically cover situations where the program depends on a
library that is part of the same project, but ignore system libraries.
(I intentionally omitted searching for -L flags in $LDFLAGS, since
these come from the user rather than the recipe author.)

jw



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn