bugmake - Bugs: bug #58556, Make is confused by a target named...


bug #58556: Make is confused by a target named ".o" and neither emptying .SUFFIXES nor MAKEFLAGS=r can prevent this

Submitted by:  Rossen Mikhov <log65536>
Submitted on:  Sat 13 Jun 2020 04:39:34 PM UTC  
Severity:  3 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  None Operating System:  None
Fixed Release:  None Triage Status:  None

Add a New Comment (Rich Markup)

You are not logged in

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


Sat 13 Jun 2020 04:39:34 PM UTC, original submission:  

In an empty directory:

$ make .o
cc      -o .o
cc: fatal error: no input files
compilation terminated.
make: *** [<builtin>: .o] Error 1

This was unexpected, because no prerequisites exist in the directory.
Looking into the relevant parts from "make -dp .o":

Considering target file '.o'.
 File '.o' does not exist.
 Finished prerequisites of target file '.o'.
Must remake target '.o'.
$(LINK.o) $^ $(LOADLIBS) -o $@

It doesn't mention trying implicit rules, so it seems to be matching the builtin as an explicit rule. Is this intentional?

Even if this is by design, there should be a way to turn it off from the makefile. I tried:

$ printf 'MAKEFLAGS=r \n .SUFFIXES:' | make - .o
cc      -o .o
cc: fatal error: no input files
compilation terminated.
make: *** [<builtin>: .o] Error 1

This is strange, because now "make -p" doesn't mention any rules involving ".o" at all, yet it still manages to call the linker.

I should note that "make -r" from the command line does work properly, and "MAKEFLAGS=r" does disable the bulitins for targets not named like a default suffix.

I also note that I found this while trying to fix a buggy makefile. Being able to actually work with a target named ".o" is not important here, it is just that a more correct error message might have helped while debugging the makefile.

Rossen Mikhov <log65536>


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

Attach Files:

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 log65536 (Submitted the item)

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

    Only logged-in users can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.5