bugmake - Bugs: bug #18963, -include suppressing errors for...

 
 

bug #18963: -include suppressing errors for too long?

Submitter:  None
Submitted:  Mon 05 Feb 2007 04:15:02 PM UTC
   
 
Severity:  3 - Normal Item Group:  Documentation
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  3.81 Operating System:  POSIX-Based
Fixed Release:  3.82 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 22 Apr 2007 08:43:27 AM UTC, comment #5: 

The last comment is about bug# 15110. Not sure if it is related to the original report.

Boris Kolpackov <bosk>
Group Member
Sat 21 Apr 2007 11:10:14 AM UTC, comment #4: 

Is this really the way it is supposed to work. It didn't work like that in previous releases of make. To exemplify, I want a makefile with automatic dependencies. If I write it like this:

--- Makefile ---
all: hello

include hello.d

%.d: %.c
$(CC) -M -MG -MT "$*.o $@" -MF $@ $<
------

--- hello.c ---
#include <stdio.h>

int main()
{
  printf("Hello\n");
}
------

I will get the following output if hello.d does not exist.

Makefile:6: hello.d: No such file or directory
cc -M -MG -MT "hello.o hello.d" -MF hello.d hello.c
cc    -c -o hello.o hello.c
cc   hello.o   -o hello

I want to get rid of the error message (because it isn't an error) so I put a "-" infront of the include directive in the makefile. Everything looks fine until I try to include a file that does not exist (e.g. hello.h) in hello.c. Then I will get the following output:

cc -M -MG -MT "hello.o hello.d" -MF hello.d hello.c

The compilation just stops with no error message. The exit code is 2 if one checks it. What I expect is a row like:

make: * No rule to make target `hello.h', needed by `hello.d'.  Stop.

This was the way it worked in earlier releases of make. Maybe there is another way around this but I cannot find it.

Regards,
Tobias

Tobias Blomberg <sm0svx>
Tue 06 Feb 2007 02:00:26 PM UTC, comment #3: 

I can see that the documentation is not clear enough.  Perhaps it is trying to be too stylized, to the point of obscuring its intent.

What the docs should say is: any included makefile (by either "include" or "-include"), whether it exists or not, will be considered a target and make will try to update it.  If the makefile exists and the update succeeds (this includes the case where make does not have any rules to update the makefile), then it is included.

If the update of the makefile fails then if it was "include"'d,  (although I think it might be a duplicmake will fail; if it was "-include"'d, make will ignore the error and continue on.  An update failing can be because the makefile does not exist and make has no rule to build it; or because the rules needed to build the makefile (or any of its prerequisites of course) failed--regardless of whether the makefile exists or not.

I'm changing this to a doc bug.

Paul D. Smith <psmith>
Group administrator
Tue 06 Feb 2007 11:28:17 AM UTC, comment #2: 

I'm aware that -include is supposed to produce no error if file.d does not exist. But in my case file.d exists, it's just that the header file.h is not there and cannot be remade. AFAICS nowhere in the manual it is mentioned that also the errors IN an EXISTING makefile fragment are suppressed with -include.

Franz.

Anonymous
Mon 05 Feb 2007 10:13:05 PM UTC, comment #1: 

-include never issues warnings or errors.  I'd previously suggested a change to that section of the manual in http://lists.gnu.org/archive/html/bug-make/2007-01/msg00002.html.  Perhaps you'd like to suggest a further or alternative change to make this clearer?

http://make.paulandlesley.org/autodep.html shows how the make maintainer recommends that you do automatic dependency generation and inclusion, if that's what you're trying to achieve here.

Martin Dorey <mdorey>
Mon 05 Feb 2007 04:15:02 PM UTC, original submission:  

with these 2 files:

Content of Makefile:
all: file.o

%.d:
        touch $@
        exit 127

%.h:
        @echo "File '$@' does not exist."
        exit 128

-include file.d


Content of file.d:
file.o file.d: file.h

I only get:
# gmake
File 'file.h' does not exist.
exit 128
#

but no error exit code. Strictly this could also be a documentation bug, because there it talks about "does not exist AND cannot be remade" for -include. Maybe the AND should be changed to OR. In that case please consider this as an enhancement request for a variation of the -include directive, which will return an error in this case.

Thanks,
Franz.

Anonymous

 

(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 bosk (Posted a comment)
  • -email is unavailable- added by sm0svx (Posted a comment)
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by mdorey (Posted a comment)
  •  

    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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-28 psmith Fixed Release4.0 3.82
    2009-08-02 psmith Open/ClosedOpen Closed
        Fixed ReleaseNone 4.0
        StatusNone Fixed
        Assigned toNone psmith
    2008-07-09 psmith Attached File#16071 Removed
    2008-07-09 None Attached File- Added get_php_80x15.png, #16071
    2007-02-06 psmith Item GroupBug Documentation

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code