|
From: | David Boyce |
Subject: | Re: Make doesn't bail on compile errors |
Date: | Fri, 23 Mar 2007 17:59:19 -0400 |
At 05:35 PM 3/23/2007, Michael L Brown wrote:
The makefile has to do the checking and stop? Oh how horrible. With Sun/Solaris make the program saw the error and bail all compiling at that point and issued an error when exiting, which the script that called the make the caught and bailed.
No, you're confused. What people are saying is that the makefile has a bug and it needs to stop having that bug. The bug is that in some way it throws away exit status. You need to find out how that's happening, or post a testable fragment here to get better help.
Make will always bail out if the build command it invoked returns a non-zero exit status, though there are ways of overriding this. There are two ways things could be going wrong:
(1) The makefile could be doing something to ignore the exit status such as a .IGNORE target, a leading "-" before a command line, or the -i flag passed in. These are all documented ways of explicitly ignoring errors.
(2) The tool you're running within the build command is not returning a correct exit status. This is quite common for locally developed scripts.
People are often confused about how much (or rather how little) make knows about what they're trying to do, their compile and link lines or whatever. In fact it knows nothing. Make sees a series of strings with a leading tab; it strips off the tabs, replaces any $(foo) variables with the value of foo, and passes the remaining text to the shell. It then waits to see if the shell returns 0 or non-zero. If 0 it does the same thing for the next target; if nonzero it exits, unless you've done one of the things noted above. The text could be a program to print "Hi there" or to launch the space shuttle; make neither knows nor cares.
David Boyce
[Prev in Thread] | Current Thread | [Next in Thread] |