[comp.unix.ultrix] makefile bug workaround?

max@jma.UUCP (Max Heffler @ Landmark Graphics) (05/21/89)

Does anybody have a workaround/PD make for Ultrix 2.0 or 3.0 s5make.
If I have the following syntax:

all:
	if [ "" != "" ] ; then echo a ; else echo b ; fi

I get an error code 1.  But not if I change the != to =.
Thanx in advance.

P.S. I am using s5make with either /bin/sh or /bin/sh5, but I believe
I had this problem with make also.
.

-- 
Max Heffler                     uucp: ..!uunet!jma!max
Landmark Graphics Corp.         phone: (713) 579-4751
333 Cypress Run, Suite 100
Houston, Texas  77094

max@jma.UUCP (Max Heffler @ Landmark Graphics) (05/21/89)

Does anybody have a copy of gnumake that runs on Ultrix 3.0?

When I link /tmp to /usr/user/tmp (different partition and disk)
the bind() command fails (local bind)
Any ideas?
-- 
Max Heffler                     uucp: ..!uunet!jma!max
Landmark Graphics Corp.         phone: (713) 579-4751
333 Cypress Run, Suite 100
Houston, Texas  77094

bin@primate.wisc.edu (Brain in Neutral) (05/22/89)

From article <153@jma.UUCP>, by max@jma.UUCP (Max Heffler @ Landmark Graphics):
> Does anybody have a workaround/PD make for Ultrix 2.0 or 3.0 s5make.
> If I have the following syntax:
> 
> all:
> 	if [ "" != "" ] ; then echo a ; else echo b ; fi
> 
> I get an error code 1.  But not if I change the != to =.
> Thanx in advance.

I've seen this sort of "if" problem under 1.2 also.  The trouble was (and
may still be for newer versions of Ultrix) that "if" returns a bad status.

Paul DuBois
dubois@primate.wisc.edu		rhesus!dubois
bin@primate.wisc.edu		rhesus!bin

paul@prcrs.UUCP (Paul Hite) (05/27/89)

In article <153@jma.UUCP>, max@jma.UUCP (Max Heffler @ Landmark Graphics) writes:
> all:
> 	if [ "" != "" ] ; then echo a ; else echo b ; fi
> 
> I get an error code 1.  But not if I change the != to =.
> Thanx in advance.
> 
> P.S. I am using s5make with either /bin/sh or /bin/sh5, but I believe
> I had this problem with make also.
> 
> Max Heffler                     uucp: ..!uunet!jma!max

You must be using /bin/sh.  This is an older shell that doesn't handle
the -e option as well as it should.  When "make" invokes a shell, it 
uses the -e option to cause the shell to exit if an error occurs.  The
problem with older shells is that they take -e too literally.  Your code
fragment will invoke test (via the [ alias) and in this case, test returns
a "failed" exit status.  If you switch to /bin/sh5 this won't happen:
	Script started on Fri May 26 15:27:49 1989
	<21> sh -ec '[ "" != "" ] || echo b'
	<22> echo $status
	1
	<23> sh5 -ec '[ "" != "" ] || echo b'
	b
	<24> echo $status
	0
	<25> ^D
	script done on Fri May 26 15:32:05 1989
As you can see the -e and flow control just don't mix with the old shell.
So one work-around is to switch to sh5 by putting a "SHELL=/bin/sh5" in your
makefile.  (Be sure that you really are using s5make because make will not
use the SHELL macro to change shells.) This employs some of the System 5 stuff
that DEC has added to Ultrix.  In a pure BSD environment, another work-around
is often used:
all:
	-if [ "" != "" ] ; then echo a ; else echo b ; fi
	^
	|  Note the minus sign

This tells "make" to ignore the exit code (i. e. don't use -e).  

Hope this helps.

Paul Hite   PRC Realty Systems  McLean,Va   uunet!prcrs!paul    (703) 556-2243
                      DOS is a four letter word!