[6994] in Athena Bugs

home help back first fref pref prev next nref lref last post

decmips 7.2P: make doesn't interpret "exit 0" as exiting with status 0

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Wed Jan 30 19:18:12 1991

To: bugs@ATHENA.MIT.EDU
Date: Wed, 30 Jan 91 19:17:53 EST
From: Chris Craig <crcraig@ATHENA.MIT.EDU>

System name:		special-agent-cooper
Type and version:	KN01 7.2P (1 update(s) to same version)
Display type:		PM-MONO

What were you trying to do?
---------------------------
Using a Makefile generated from imake, trying to build something.  The
following construct caused make to exit with error #1 if the test was
false. 

all::
        if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi

What's wrong:
-------------

"exit 0" shouldn't cause make to exit.  The script below shows the
incorrect behavior.
-------------------
[/tmp/test] (crcraig@special-agent-cooper:  7:07pm)
% cat Makefile

all::
        if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi
        @echo "success"
[/tmp/test] (crcraig@special-agent-cooper:  7:12pm)
% ls -l
total 2
-rw-rw-r--  1 crcraig        84 Jan 30 18:58 Makefile
drwxrwxr-x  2 crcraig       512 Jan 30 19:04 debugger/
[/tmp/test] (crcraig@special-agent-cooper:  7:12pm)
% make all
if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi
*** Error code 1

Stop.

What should have happened:
--------------------------

Since /bin/sh returns 0 (see below), make should continue.

[/tmp/test] (crcraig@special-agent-cooper:  7:12pm)
% /bin/sh
$ if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi
$ echo $?
0

Please describe any relevant documentation references:
------------------------------------------------------

Interestingly, gmake works correctly.  Also, telling make to ignore
the error works as well, but since this Makefile is generated from
imake, that's not a great solution.

home help back first fref pref prev next nref lref last post