Cygwin script compilation problem (f77)
Can anyone suggest a solution to a compiler problem (f77)
which arises when I try to execute a bash script
("compile" see [1] below) running under Cygwin on WinXP.
The script finds the correct file(s) but the compiler does
not recognize them as fortran source files. If the script
is executed sequentially from the command line then there
is no problem.
The directory structure of flh971da contains two subdirectories
flh971da/scripts and flh971da/source. The compile script [1] is shown
(in part) below. The script changes directory to flh971da/source,
and compiles source from subdirectories flh971da/source/n where
n=a,b,c etc and places the object files in flh971da/source/nobj
n=a,b,c... etc. The response to flh971da/scripts/compile script is
given below [2]. It is clear that the compiler (f77) locates the
correct source file [4] (flh971da/source/a/a00aaft.f) but does not
recognize it as a fortran source file.
All relevant files have been processed with d2u.
I suspect the problem is with the script, but I have
no idea how to fix it.
[1] (flh971da/scripts/compile)
.........................................................................
#!/bin/sh
# This script compiles all the Library source.
#
. fortopts
OPTIONS=$UNOPT
cd ../source
if [ ! -d aobj ]
then
mkdir aobj
fi
cd aobj
$F77 $STD $OPTIONS $NOLNK ../a/a00aaft.f
exit 1
[2] (compiler response)
..........................................................................
$ cd ~/flh971da
$ cd scripts
$ ./compile
../a/a00aaft.f: line 1: SUBROUTINE: command not found
../a/a00aaft.f: line 2: C: command not found
../a/a00aaft.f: line 3: C: command not found
../a/a00aaft.f: line 4: C: command not found
../a/a00aaft.f: line 5: C: command not found
../a/a00aaft.f: line 6: C: command not found
../a/a00aaft.f: line 7: C: command not found
../a/a00aaft.f: line 8: C: command not found
../a/a00aaft.f: line 9: C: command not found
../a/a00aaft.f: line 10: INTEGER: command not found
../a/a00aaft.f: line 11: C: command not found
../a/a00aaft.f: line 12: syntax error near unexpected token `('
../a/a00aaft.f: line 12: ` CHARACTER*80 MSG(20)'
[3] (flh971da/scripts/fortopts)
.........................................................................
#!/bin/sh
# Script sets some variables used by various tools
#
F77='f77' # name of Fortran compiler
NOLNK='-c' # flag to prevent linking
STD=' ' # flag for compiling source to make a shared library
UNOPT='' # flag for no optimization
[4] (flh971da/source/a/a00aaft.f)
..............................................................................
SUBROUTINE A00AAF
C MARK 15 RE-ISSUE. NAG COPYRIGHT 1991.
C
C Writes information about the particular implementation of the
C NAG Library in use.
C
C The output channel is given by a call to X04ABF.
C
C .. Local Scalars ..
INTEGER I, NADV
C .. Local Arrays ..
CHARACTER*80 MSG(20)
C .. External Subroutines ..
EXTERNAL A00AAZ, X04ABF, X04BAF
C .. Executable Statements ..
CALL A00AAZ(MSG)
CALL X04ABF(0,NADV)
DO 20 I = 1, 7
CALL X04BAF(NADV,MSG(I))
20 CONTINUE
CALL X04BAF(NADV,MSG(20))
RETURN
END
............................................................................
Last edited by wootletootle; 04-05-2011 at 04:44 AM.
|