%% "Michael Sterrett -Mr. Bones.-" <[EMAIL PROTECTED]> writes:

  ms> Is there any way to dynamically generate vpath directives?

No.

  ms> LIBS = -L/auto/lib/oracle/7.3.4.4.0 -L/auto/lib -L/lib -lsubslib -loroe \
  ms> -lcrtlib -ltermcap -ldate -lutil -lsqlgen -lpsclib -lbitrange -lbcf -lstr \
  ms> -lrgetrotate -lrpc \

  ms> And generate something like this:

  ms> vpath %.a /auto/lib/oracle/7.3.4.4.0
  ms> vpath %.so /auto/lib/oracle/7.3.4.4.0

  ms> vpath %.a /auto/lib
  ms> vpath %.so /auto/lib

  ms> vpath %.a /lib
  ms> vpath %.so /lib

  ms> I can dynamically create the VPATH variable:

  ms> VPATH = $(subst -L,,$(sort $(filter -L%,$(LIBS))))

  ms> and that works, but setting VPATH allows gmake to go searching for
  ms> missing files other then libraries in VPATH directories and I
  ms> don't want it to do that.  I was thinking that since vpath can be
  ms> based on file extension that I would use that, but since it's a
  ms> directive, I don't see how I can generate it dynamically without
  ms> getting messy with sed and including a file or something.

Including a file is the only thing you can do.  You don't need sed,
though.

  include vpaths.mk

  vpaths.mk: Makefile
          for L in $(patsubst -L%,,$(filter -L%,$(LIBS))); do \
            echo "vpath %.a $$L"; echo "vpath %.so $$L"; \
          done

I'm working on a new feature which I intend to be the main focus of GNU
make 3.80 which will make what you want to do possible without needing a
auto-re-exec trick as above.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.ultranet.com/~pauld/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

Reply via email to