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

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

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

anonymous

URL:
  <http://savannah.gnu.org/bugs/?29104>

                 Summary: Directory Search for Link Libraries doesn't work in
implicit rules
                 Project: make
            Submitted by: tari3x
            Submitted on: Sun Mar  7 08:47:40 2010
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 3.81
        Operating System: MS Windows
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:


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.





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29104>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-make mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

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

anonymous

Follow-up Comment #1, bug #29104 (project make):

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

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29104>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-make mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

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

anonymous

Follow-up Comment #2, bug #29104 (project make):

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

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29104>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-make mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

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

anonymous

Update of bug #29104 (project make):

        Operating System:              MS Windows => Any                    
           Triage Status:                    None => Verified              

    _______________________________________________________

Follow-up 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.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29104>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


_______________________________________________
Bug-make mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|

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

anonymous
Follow-up Comment #4, bug #29104 (project make):

Duplicated by bug #56732

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?29104>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/