help-make
[Top][All Lists]
Advanced

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

Re: Linking rule advice


From: Paul D. Smith
Subject: Re: Linking rule advice
Date: Mon, 6 Jun 2005 09:54:30 -0400

%% Darin Johnson <address@hidden> writes:

  dj> I've got over 100 libraries to link in a final build, and the
  dj> command lines are extremely long.  I'd like to use the "-lthing"
  dj> syntax with a "-L" flag to shorten things.  What I've got now is
  dj> something like:

  dj>     mytarget: $(OBJS) $(LIBRARIES)
  dj>     ...
  dj>     # in a "rules.mk" file
  dj>     $(outdir)/%.elf:
  dj>             $(LINK.o) $^ $(LDLIBS) -o $@

  dj> But the $^ expands into full paths.

You have two choices:

 1) Use the "-lfoo" syntax on the prerequisites list, and make sure that
    the directory containing the libraries is listed via VPATH or vpath.

    See the GNU make manual for how make handles these special
    prerequisites.

 2) Use functions to manipulate the contents of $^ when you run the
    shell.  Because it's a requirement that the libraries keep their
    same order, this is very tricky to do.  I expect you'll need to use
    eval to do it.  I suggest using option #1 :-)

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