bugmake - Bugs: bug #29104, Directory Search for Link...


bug #29104: Directory Search for Link Libraries doesn't work in implicit rules

Submitted by:  Misha <tari3x>
Submitted on:  Sun 07 Mar 2010 08:47:40 AM UTC  
Severity: 3 - NormalItem Group: Bug
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
Component Version: 3.81Operating System: Any
Fixed Release: NoneTriage Status: Verified

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Thu 01 Jul 2010 07:35:04 AM UTC, comment #3:

This is a real bug. Misha's original version SHOULD work; after all it works fine to do something like this:

And "-lm" should be no different. The problem is that the code that manages extra prerequisites for pattern rules is not enhanced to understand the special "-l*" form of prerequisite for library searching.

Paul D. Smith <psmith>
Project Administrator
Sun 07 Mar 2010 02:48:23 PM UTC, comment #2:

hi Tim,

thanks for the clarification!

> This is reasonably sensible - since not all exes in the entire universe really to link to libm.

No, but in other cases it may be useful. Suppose you compile a separate profiling-enabled version of each executable and link in some profiling support library. Then you would like to write

%.exe: %.c

%.prof.exe: CFLAGS += -DENABLE_PROF
%.prof.exe: -lmyprof


Misha <tari3x>
Sun 07 Mar 2010 10:04:27 AM UTC, comment #1:


The syntax for a pattern rule does not allow you to specify anything other than the input file and the output file. but you can still add further prerequisites to get what you want like so:

BUILD_CMD = $(CC) $^ -o $@
all: main.exe
%.exe: %.c

main.exe: -lm

This is reasonably sensible - since not all exes in the entire universe really to link to libm.



Timothy N Murphy <tnmurphy>
Sun 07 Mar 2010 08:47:40 AM UTC, original submission:

This works:

BUILD_CMD = $(CC) $^ -o $@
all: main.exe
main.exe: main.c -lm

This doesn't:

BUILD_CMD = $(CC) $^ -o $@
all: main.exe
%.exe: %.c -lm

I would expect both versions to do the same.

Misha <tari3x>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by tnmurphy (Posted a comment)
  • -unavailable- added by tari3x (Submitted the item)
  • -unavailable- added by tari3x

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 01 Jul 2010 07:35:04 AM UTCpsmithOperating SystemMS Windows=>Any
      Triage StatusNone=>Verified
    Sun 07 Mar 2010 08:47:40 AM UTCtari3xCarbon-Copy-=>Added tari3x

    Back to the top

    Powered by Savane 3.1-cleanup1