Matt England wrote:
VPATH/vpath: does it work for -l<libname> prereqs?

Yes, but there's special handling of this syntax detailed in the GNU Make manual section "Directory Search for Link Libraries" and I quote:

  "When a prerequisite's name has the form `-lNAME', `make' handles it
  specially by searching for the file `libNAME.so' in the current
  directory, in directories specified by matching `vpath' search paths
  and the `VPATH' search path, and then in the directories `/lib',
  `/usr/lib', and `PREFIX/lib' (normally `/usr/local/lib', but
  MS-DOS/MS-Windows versions of `make' behave as if PREFIX is defined to
  be the root of the DJGPP installation tree).

   If that file is not found, then the file `libNAME.a' is searched
  for, in the same directories as above."

You might like to post a snippet of Makefile so that people here can help you debug. Here's a sample that does work:

    all: my_executable

    my_executable: -lm
        link_it $@ $^

(Run with -n since link_it isn't a real program :-)

    % make -n
    link_it my_executable /usr/lib/libm.so

Now suppose there's a libm.so in the current directory you'll see:

    % make -n
    link_it my_executable /usr/lib/libm.so

Or suppose there's a libm.so in ./subdir and you do

    % make -n VPATH=./subdir
    link_it my_executable ./subdir/libm.so

Or even add 'vpath %.so ./subdir' to the Makefile:

    % make -n
    link_it my_executable ./subdir/libm.so

Now one thing to watch for is if your library is a .a and has the same name as a .so the search order used by GNU Make (see above) will cause the .so to be found and used first. If that's a problem then you can either stop using the -l syntax, or you can fiddle with .LIBPATTERNS so that the search happens in the opposite order.

John.
--
John Graham-Cumming
[EMAIL PROTECTED]

Home: http://www.jgc.org/
POPFile: http://getpopfile.org/
GNU Make Standard Library: http://gmsl.sf.net/
Fast, Parallel Builds: http://www.electric-cloud.com/

Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/

PGP key: http://www.jgc.org/pgp/



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to