help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how can gnu make return 2 and not show any errors?


From: Mike Shal
Subject: Re: how can gnu make return 2 and not show any errors?
Date: Tue, 20 Oct 2009 13:06:56 -0400

On 10/20/09, Paul Smith <address@hidden> wrote:
> On Tue, 2009-10-20 at 09:43 -0700, Mark Galeck (CW) wrote:
>
>  > How can it be – my gnu make is returning 2 but does not show any
>  > errors.  I am using –include directive, but I checked and indeed, if
>  > make ignores errors because of –include, then it returns 0, as it
>  > should.
>  >
>  > So what else could it be?  (I can’t send you a short example, I can’t
>  > find the short example that would do that, and the makefile I am
>  > working with is in excess of 10000 lines).
>
>
> Are you sure there wasn't an error further up the build?
>
>  There are some bugs in 3.81 around error handling and "-include" but I'm
>  not sure if these exact symptoms would be involved.  Boris fixed them a
>  week or two ago.  I'm working on getting out a release candidate for
>  3.82, so if you wanted to try the GNU make currently in CVS and see if
>  that worked any better it would be interesting.
>

I've seen a similar problem before. I don't know the exact
circumstances that cause it, but this small set of files seems to
reproduce it. You will want to create ok.d manually - the normal
behavior of gcc -MMD doesn't seem to put ok.d in the ok.d file.

$ cat Makefile
all: ok.o
        echo all done
-include ok.d
ok.o: ok.c
        echo compile ok.c
$ cat ok.c
$ cat ok.d
ok.o ok.d: ok.c ok.h

$ make
$ echo $?
2

What's weird is if you remove the "ok.d" part from the ok.d file, you
get an actual error message:

$ make
make: *** No rule to make target `ok.h', needed by `ok.o'.  Stop.
$ echo $?
2

Basically you have to have a dependency file that is dependent on a
missing file (here, ok.h). I don't know why the error text only shows
up in the one in not the other though. This is make-3.81

In any case, I don't think make will ever handle file deletions
correctly. If you remove files (or do an update from revision control
that removes files), you are better off rebuilding everything from
scratch.

-Mike




reply via email to

[Prev in Thread] Current Thread [Next in Thread]