[comp.unix.xenix] Makefile question

tuck@iris.ucdavis.edu (Devon Tuck) (01/07/89)

I am having difficulties using a Makefile for compiling LPI-Fortran
programs.  The following does not work for me, and I assume I have not
scrutinized the make instructions well enough to catch the problem.

test:	test.o
	ldfortran -o test test.o
test.o:	test.f
	lpifortran test.f

The error I get is:

NAME: ldfortran   -  Command not found
INAME: lpifortran -  Command not found
.
.
etc.

It may or may not be helpful to know that make seems to work for me under
some conditions for lpifortran command, and even when I substitute
something like "date" for ldfortran, but if I try to substitute a shell
script  I get an error as well.

If any of you have successfully "made" with ldfortran, just mailing me your
makefile will do wonerfully.

Thanks,
	Devon

rosso@sco.COM (Ross Oliver) (01/12/89)

In article <3450@ucdavis.ucdavis.edu> tuck@iris.ucdavis.edu (Devon Tuck) writes:
>I am having difficulties using a Makefile for compiling LPI-Fortran
>programs.  The following does not work for me, and I assume I have not
>scrutinized the make instructions well enough to catch the problem.
>
>test:	test.o
>	ldfortran -o test test.o
>test.o:	test.f
>	lpifortran test.f
>
>The error I get is:
>
>NAME: ldfortran   -  Command not found
>INAME: lpifortran -  Command not found
>.
>.
>etc.

We traced the cause of this to the fact that /usr/bin/ldfortran
is actually a Bourne shell script.  The make utility executes
the command lines in the makefile using the shell specified in
the SHELL environment variable, normally set to your login shell
by /etc/login.  In this case, SHELL was set to /bin/csh.  However,
the first three non-comment lines in /usr/bin/ldfortran are:

NAME=ldfortran
INAME=lpifortran
VERSION=03.00.00

These are valid variable assignment statements to the Bourne shell,
but are interpreted as external commands by the C shell, resulting
in the errors

NAME=ldfortran: Command not found
INAME=lpifortran: Command not found
VERSION=03.00.00: Command not found

The shell script then exited with a non-zero exit code, causing
make to quit.  The easiest way to correct this problem is to
add the following line to the top of your makefile:

SHELL=/bin/sh

Make will then execute commands using the Bourne shell rather
than the C shell.  This is only necessary if you need to execute
Bourne shell scripts from within you makefile, and you use the
C shell as your login shell.

Ross Oliver
Technical Support
The Santa Cruz Operation, Inc.