Makefile question

Ross Oliver rosso at sco.COM
Thu Jan 12 09:48:19 AEST 1989


In article <3450 at ucdavis.ucdavis.edu> tuck at 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.



More information about the Comp.unix.xenix mailing list