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

 
 

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

Submitter:  Misha <tari3x>
Submitted:  Sun 07 Mar 2010 08:47:40 AM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  3.81 Operating System:  Any
Fixed Release:  None Triage Status:  Verified
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 27 Dec 2019 07:08:54 AM UTC, comment #4: 

Duplicated by bug #56732

Paul D. Smith <psmith>
Group administrator
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:

%.exe : %.c foo.h


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>
Group 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
  $(BUILD_CMD)

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

Best,
  Misha

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

Hi,

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
        $(BUILD_CMD)

main.exe: -lm

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


Regards,

Tim

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
$(BUILD_CMD)

This doesn't:

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

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 Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-01 psmith Operating SystemMS Windows Any
        Triage StatusNone Verified
    2010-03-07 tari3x Carbon-Copy- Added tari3x

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code