RM> On 2003-08-22 21:01 +0000, Robert Mecklenburg wrote: RM> I was attempting to use the -l link flag feature in a prerequisite and RM> discovered a surprising feature. make will not match a -lxx RM> prerequisite with a libxx.a target. The obvious makefile works: RM> RM> count_words: count_words.o libcounter.a RM> libcounter.a: libcounter.a(lexer.o) RM> RM> But when the libcounter.a prereq is changed to the -l form it fails: RM> RM> count_words: count_words.o -lcounter RM> libcounter.a: libcounter.a(lexer.o) RM> RM> When run yields: RM> RM> $ make RM> gcc -c -o count_words.o count_words.c RM> make: *** No rule to make target `-lcounter', needed by `count_words'.Stop.
AM> You mean you expected GNU make to somehow guess that "-lcounter" AM> refers ./libcounter.a ? Which flavour of make(1) does that ? Don't sound so shocked. GNU make already accepts -lNAME as a prerequisite quite nicely. It searches its vpath for libNAME.so and libNAME.a and expands the "-lNAME" prereq into an absolute path. This code has existed for a decade (I, personally, was using it a decade ago). It isn't much of a leap for make to "search" the target list for "libNAME.so" or "libNAME.a" (of course, the actual code might be difficult, I don't know). In particular, the -lNAME does "work" if you include your binary output dir in your vpath and it already includes the built library. That isn't surprising, just an "artifact" of the normal search process. I just thought I'd ask if this had come up or was on a todo list somewhere. Cheers, -- Robert _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
