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

 
 

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

Submitted by:  None
Submitted on:  Mon 05 Feb 2007 04:15:02 PM UTC  
 
Severity: 3 - NormalItem Group: Documentation
Status: FixedPrivacy: Public
Assigned to: Paul D. Smith <psmith>Open/Closed: Closed
Component Version: 3.81Operating System: POSIX-Based
Fixed Release: 3.82Triage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

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>
Project 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>
Project AdministratorIn charge of this item.
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 File(s):
   
   
Comment:
   

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

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

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 28 Jul 2010 06:18:54 AM UTCpsmithFixed Release4.0=>3.82
    Sun 02 Aug 2009 06:50:53 PM UTCpsmithOpen/ClosedOpen=>Closed
      Fixed ReleaseNone=>4.0
      StatusNone=>Fixed
      Assigned toNone=>psmith
    Wed 09 Jul 2008 12:51:43 PM UTCpsmithAttached File#16071=>Removed
    Wed 09 Jul 2008 07:33:42 AM UTCNoneAttached File-=>Added get_php_80x15.png, #16071
    Tue 06 Feb 2007 02:00:26 PM UTCpsmithItem GroupBug=>Documentation

    Back to the top


    Powered by Savane 3.1-cleanup1