#!/bin/bash # #+ # NAME: # olb # PURPOSE: # Recompile all F77 subroutines and functions, and create object library # $for/libgen.a from the object files # CALLING SEQUENCE: # $com/olb # $com/olb module (where 'module' is a fortran module being updated, e.g. forgen) # INPUTS: # Fortran files are selected from a number of subdirectories in $for: # - most of the library files in $for/lib are included # - in addition some OS-dependent files are included from $for/os and $for/os/linux # OUTPUTS: # New or updated object library $for/libgen.a # SIDE EFFECTS: # A compilation status line is added to $sys/olb.log # RESTRICTIONS: # This script can only be executed from the soft account (i.e. $USER=soft). # The line includes the time of compilation and the module updated (if present) # PROCEDURE: # Object files are created $temp and deleted after use # The library is created in $for # # The g77 command looks for include files in the directories $for/h and # $for/h/linux. Two other switches are included: # -ffixed-line-length-none -> extended fortran # -c -> suppresses linking into executable # # Some of the fortran files are compiled with the -w switch added to suppress # warning messages, mostly about unimplemented intrinsics such as cosd, sind, etc. # # An earlier version also used the switches to be able to use our old 'signal' subroutine # (signal is a unix function included in the badu77 group and the unix group of intrinsics): # -fbadu77-intrinsic-hide # -funix-intrinsic-hide # Since 'signal' has been renamed 'say' we don't need these anymore. # MODIFICATION HISTORY: # FEB-2001, Paul Hick (UCSD/CASS; pphick@ucsd.edu) #- # Make sure that the object libraries is created only from the # soft account. if [ "$USER" != "soft" ] then echo Should only be used on the soft account exit fi # If a compiler is explicitly selected using a keyword, then # the compilation will fail if a compiler is requested that is # not installed on the machine. if [ "$1" == "-g77" ] then if [ -z "$(which g77 2> /dev/null)" ] then echo No g77 compiler available exit 1 fi # Use g77 compiler echo Using $(which g77) f77="g77 -w -ffixed-line-length-none -I$for/h -I$for/h/linux -L$for" elif [ "$1" == "-intel" ] then if [ -z "$(which ifc 2> /dev/null)" ] then echo No Intel compiler available exit 1 fi echo Using $(which ifc) echo Still have to set up the Intel compiler exit 1 elif [ "$1" = "-absoft" -o -n "$ABSOFT" ] then echo Using $ABSOFT/bin/f77 f77="$ABSOFT/bin/f77 -I$for/h -I$for/h/linux -W -V -N109" elif [ -n "$(which ifc 2> /dev/null)" ] then echo Using $(which ifc) f77="ifc -I$for/h -I$for/h/linux -132" elif [ -n "$(which g77 2> /dev/null)" ] then echo Using $(which g77) f77="g77 -I$for/h -I$for/h/linux -ffixed-line-length-none" else echo "No Fortran compiler available ??" exit 1 fi if [ "$1" = "-absoft" -o "$1" = "-intel" -o "$1" = "-g77" ] then shift fi when=$(date +"%Y-%m-%d %H:%M:%S") logf=$sys/olb.log if [ "$1" = "" ] then $f77 -c -w $for/lib/forbytes.f -o$temp/forbytes.o $f77 -c -w $for/lib/formap.f -o$temp/formap.o $f77 -c -w $for/lib/forgen.f -o$temp/forgen.o $f77 -c $for/lib/formath.f -o$temp/formath.o $f77 -c $for/lib/forstr.f -o$temp/forstr.o $f77 -c $for/lib/forstr2.f -o$temp/forstr2.o $f77 -c -w $for/lib/forhos.f -o$temp/forhos.o $f77 -c -w $for/lib/forplt.f -o$temp/forplt.o $f77 -c $for/lib/fordummy.f -o$temp/fordummy.o $f77 -c -w $for/lib/foripsd.f -o$temp/foripsd.o $f77 -c -w $for/lib/foripsg2.f -o$temp/foripsg2.o $f77 -c $for/os/linux/isearch_linux.f -o$temp/isearch_linux.o $f77 -c $for/os/linux/iopen_linux.f -o$temp/iopen_linux.o $f77 -c $for/os/linux/fileinfo.f -o$temp/fileinfo.o $f77 -c $for/os/hosinquire.f -o$temp/hosinquire.o $f77 -c $for/os/logmod.f -o$temp/logmod.o if [ "$ABSOFT" == "" ] then $f77 -c $for/os/goniod.f -o$temp/goniod.o fi $f77 -c $for/os/linux/os_linux.f -o$temp/os_linux.o if [ -f $for/libgen.a ] then rm $for/libgen.a fi ar -rcv $for/libgen.a $temp/*.o logstr="$when status: $?" else if [ -f $for/lib/$1.f ] then $f77 -c -w $for/lib/$1.f -o$temp/$1.o elif [ -f $for/os/$1.f ] then $f77 -c -w $for/os/$1.f -o$temp/$1.o else $f77 -c -w $for/os/linux/$1.f -o$temp/$1.o fi if [ -f $temp/$1.o ] then ar -rv $for/libgen.a $temp/$1.o logstr="$when status: $? $1" fi fi if [ "$logstr" != "" ] then echo $logstr touch $logf echo $logstr >> $logf fi ranlib $for/libgen.a rm $temp/*.o