help-make
[Top][All Lists]
Advanced

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

Re: Don't understand VPATH and -l prerequisites


From: Paul D. Smith
Subject: Re: Don't understand VPATH and -l prerequisites
Date: Wed, 30 May 2001 16:46:20 -0400

%% Barry D Benowitz <address@hidden> writes:

  bdb> VPATH =/my/library/path

  bdb> target : target.o -lmylib

  bdb> What happened was it found the library (libmylib.a) generated the
  bdb> full path to it (ie /my/library/path/libmylib.a) and included
  bdb> that.

Yes, this is exactly what the manual says will happen.

  bdb> What I hoped would happen is that it would maintain the -l so
  bdb> that the library would be searched, instead of included. How can
  bdb> I do this?

Any number of ways.  For example:

  LIBS = -lmylib

  VPATH = /my/library/path

  target: target.o $(LIBS)
        $(CC) -o $@ $(filter-out %.a,$^) $(VPATH:%=-L%) $(LIBS)

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "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]