Article View: fj.sys.misc
Article #1380A f77 clone for IBM Power station (AIX).
From: mhiroshi
Date: Sat, 07 Mar 1992 10:53
Date: Sat, 07 Mar 1992 10:53
556 lines
17253 bytes
17253 bytes
$B$3$l$O(J,IBM/RS6000 POWER station $B$N>e$G(J, (BSD) UNIX $B$N(J f77 $B$H$=$C$/$j$J(J f77 $B%3%^%s%I$r<B8=$9$k%7%'%k%9%/%j%W%H$G$9(J. f77 : f77command f77cpp : preprocessor f77.1 : online manual f77 $B$H(J f77cpp $B$r%3%^%s%I%Q%9$K(J (/usr/local/bin $B$J$I$K(J) $BCV$-$^$9(J. ------------------------------------ cut here --------------------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # f77 # f77.1 # f77cpp # This archive created: Sat Mar 7 08:20:33 1992 export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'f77' then echo shar: "will not over-write existing file 'f77'" else cat << \SHAR_EOF > 'f77' : #! /bin/sh ######################################################################## # Thu Mar 7 23:53:48 JST 1991 # # # # A Fortran Compiler Front-end for AIX/PowerStation(RS/6000) # # # # Very Similar to the Standard UNIX f77 . # # # # Written by H. Murakami. # # # ######################################################################## DEBUG=1 # to debug this shell script. DEBUG=0 # not to debug this shell script. # The name of this file is set to progname. progname=`basename $0` #----------------------------------------- # Language processors. #----------------------------------------- CPP="f77cpp" # The C preprocessor. CPP_OPT="-Daiws -Dunix -Daixpower -DRS6000 -DIEEE -DNLS" # Predefined macro variables. #XLF="/usr/bin/xlf -qflag=W:W" # The full path name of the xlf compiler. XLF="/usr/bin/xlf -qflag=W:W -qdebug=ngrav" # full path name of xlf compiler. F_OPT="" FORT_LIBS="" # Runtime libraries for fortran. SEVERE="E"; # E means compilation process stops just after the error. # [I|W|E|S|U] I:informational,Warning, Error, Severe_error, Unrecoverble. AS="/usr/bin/xlf" # The full path name of the assembler. LINK="/usr/bin/xlf" # The full path name of the loader. LD_OPT="" # START="/lib/crt0.o" # The runtime environment object. MSTART="/lib/mcrt0.o" # The runtime environment object file for the profilling. GSTART="/lib/gcrt0.o" # The runtime environment object file for the gprofilling. #----------------------------------------- # Tools. #----------------------------------------- BASENAME="/bin/basename" # The full path name of the "basename". UNTAB="/usr/bin/untab" # The full path name of the "untab". ECHO="/bin/echo" # The full path name of the "echo". RM="/bin/rm" # The full path name of the "rm" #----------------------------------------- # Other variables. #----------------------------------------- OBJ_LIST="" FILELIST="" LIB_LIST="" SYS_LIBS="" LOAD=1 # Linking the object file is the default. AOUT="a.out" # a.out is the default executable name to be created. EXPAND_ONLY=0 # expand the cpp macro is not default. GEN_OBJ=1 # Generate object file is the default. MANPG="/u/hiroshi/local/man/man1/f77.1" # manual page for f77. NOEXTNAME=0 # 0:Add underscore to external names. #----------------------------------------- # process options. #----------------------------------------- while [ "$1" != "" ] do case $1 in #----------------------------------------------------------------------- -ansi) F_OPT=$F_OPT" -qfips";; # Only ANSI FIPS syntax allowed. -B*) F_OPT=$F_OPT" $1";; # change the base of the compiler. -c) LOAD=0 ;; # Executable is not made. -compstat) F_OPT=$F_OPT" -qstat";; # report compiler statistic in lst. -C) F_OPT=$F_OPT" -C";; # Runtime array bound check. -debug) DEBUG=1;; # Debug this shell script. -D) F_OPT=$F_OPT" -D";; # Activate dline in fortran source. -D*) CPP_OPT="$CPP_OPT $1" ;; # Define MACRO variable. -extchk) F_OPT=$F_OPT" -qextchk";; # procedure interface checking. -E) EXPAND_ONLY=1 ;; # Expand MACRO only. -free) F_OPT=$F_OPT" -k";; # Free format source code accepted. -F) EXPAND_ONLY=1 ;; # Expand MACRO only. -g) F_OPT=$F_OPT" -g" ;; # Symbol table added for debugging. -I2) F_OPT=$F_OPT" -qnoi4";; # Integer are two bytes. -I*) CPP_OPT=$CPP_OPT" $1" ;; # Include directory. -list) F_OPT=$F_OPT" -qsource";SEVERE="U";;# Output Source listing. -listopt) F_OPT=$F_OPT" -qlistopt";; # List the effective option list. -loadmap) LD_OPT=$LD_OPT" -bloadmap:load.map";; # to make loadmap. -l*) SYS_LIBS=$SYS_LIBS" $1" ;;# Specify the standard library. -L*) LD_OPT=$LD_OPT" $1" ;; # Specify the directory for library. -man) nroff -man $MANPG | more ; exit 0;; # output manual page. -map) ;; # Output the symbol map. (Not Yet) -maxcharlen) F_OPT=$F_OPT" -qcharlen($2)";shift;; # Maximal charlength. #-noalign) F_OPT=$F_OPT" -qnoalign";;# dummy args in subr are aligned. -noextname) NOEXTNAME=1;; # Add underscore to external names. -nofold) F_OPT=$F_OPT" -qnofold";; # Ban constant float folding. -nomaf) F_OPT=$F_OPT" -qnomaf";; # No MAF opcode used. -noobj) F_OPT=$F_OPT" -qnoobj"; GEN_OBJ="0" ;;# No object file created. -nouflow) ;; # Supress under flow. (not yet.) -N\?) F_OPT=$F_OPT" -N";; # ask about the compiler table options. -N*) F_OPT=$F_OPT" $1";; #set the various compiler table size. -o) AOUT="$2" ;shift ;; # Specify the name of executable. -O) F_OPT=$F_OPT" $1" ;; # Optimization Max = (3). -p) F_OPT=$F_OPT" $1";LD_OPT=$LD_OPT" $1";START=$MSTART;;# Profiler. -pg) F_OPT=$F_OPT" $1";LD_OPT=$LD_OPT" $1";START=$GSTART;; # Call graph profiler. -phaseinfo) F_OPT=$F_OPT" -qphsinfo";; # show the compiler phase timing. -q) ;; # Compile quietly. (Not Yet) -Q*) F_OPT=$F_OPT" $1";; # Inline expansion control. -recursive) F_OPT=$F_OPT" -qrecur";;#allow recursive call of subprogram. -round) F_OPT=$F_OPT" -y$2";shift;;# compile time rounding of const. # -round [n|m|p|z] -single) F_OPT=$F_OPT" -qrndsngl";; #strict to IEEE for single precision -static) ;; # Variables become static as default. (Not Yet) -symbol) F_OPT=$F_OPT" -qattr=full";;# generate the attribute table. -S) F_OPT=$F_OPT" -qlist" ;; # Pseudo Assembler listing output. -u) F_OPT=$F_OPT" -u" ;; # Force implicit undefined. -U) F_OPT=$F_OPT" -U" ;; # Suppress lowercase conversion. -U*) CPP_OPT="$CPP_OPT $1" ;; # Undefine MACRO variable. -v) F_OPT=$F_OPT" $1" ;; # Verbose compiler stage. -w) F_OPT=$F_OPT" -w";; # Suppress warning messages. -xref) F_OPT=$F_OPT" -qxref";; # Output cross reference table. -1) F_OPT=$F_OPT" -1" ;; # (Execute Do loop at least once) -66) ;; # Featuare Fortran 66 accepted. (Not Yet) -\#) F_OPT=$F_OPT" -\#";; # trace of the compiler. -*) LD_OPT=$LD_OPT" $1";; # Other options are passed to ld. #----------------------------------------------------------------------- *) FILELIST=$FILELIST" $1";; # to be file names. esac; shift; done F_OPT="-qhalt=$SEVERE "$F_OPT; if [ $NOEXTNAME = 0 ] then F_OPT=$F_OPT" -qextname"; fi # Debug information of this script. if [ $DEBUG = 1 ] then $ECHO "CPP_OPT=$CPP_OPT"; $ECHO "F_OPT=$F_OPT"; $ECHO "LD_OPT=$LD_OPT"; $ECHO "FILELIST=$FILELIST"; $ECHO "AOUT=$AOUT"; fi #----------------------------------------- # Process the files according the file type. #----------------------------------------- for f in $FILELIST do case $f in *.F) ######## FORTRAN PROGRAM WITH MACRO. if ( test ! -r "$f" ) then $ECHO "$progname: file $f cannot be read." 1>&2; exit 1; fi; $ECHO "$f:" 1>&2 ; fn=`$BASENAME $f .F` ; if [ $DEBUG = 1 ] then echo "$CPP -P $CPP_OPT $f | $UNTAB > $fn.f " fi $CPP -P $CPP_OPT $f | $UNTAB > "$fn".f ; if ( test "$?" -ne "0" ) then exit 1; fi; if [ "$EXPAND_ONLY" = "0" ] then if [ "$DEBUG" = "1" ] then echo $XLF -c $F_OPT "$fn".f fi $XLF -c $F_OPT "$fn".f 1>&2; if ( test "$?" -ne "0" ) then echo ""; echo "$progname: Error in $f" $RM -f "$fn".o # This is to kill the bug of xlf. exit 1 ; else #if success, erase the .f file. $RM "$fn".f ; fi; OBJ_LIST="$OBJ_LIST $fn.o" ; fi; ;; *.f) ####### FORTRAN PROGRAM WITHOUT MACRO. if ( test ! -r "$f" ) then $ECHO "$progname: file $f cannot be read." 1>&2; exit 1; fi; $ECHO "$f:" 1>&2 fn=`$BASENAME $f .f` if [ $DEBUG = 1 ] then echo $XLF -c $F_OPT $f fi $XLF -c $F_OPT $f 1>&2; if ( test "$?" -ne "0" ) then echo "" echo "$progname: Error in $f" $RM -f "$fn".o # This is to kill the bug of xlf. exit 1 fi OBJ_LIST="$OBJ_LIST $fn.o" ;; *.s) # Assembly language program. if ( test ! -r "$f" ) then $ECHO "$progname: file $f cannot be read." 1>&2; exit 1; fi; if [ $GEN_OBJ = 1 ] then $ECHO "$f:" 1>&2 ; fn=`$BASENAME $f .s` ; $AS -c $F_OPT $f; if ( test "$?" -ne "0" ) then echo ""; echo "$progname: Error in $f" $RM -f "$fn".o # This is to kill the bug of xlf. exit 1; fi; OBJ_LIST="$OBJ_LIST $fn.o" ; fi; ;; *.o) # Object file. if ( test ! -r "$f" ) then $ECHO "$progname: file $f cannot be read." 1>&2; exit 1; fi; OBJ_LIST="$OBJ_LIST $f" ; ;; *.a) # Library files. if ( test ! -r "$f" ) then $ECHO "$progname: file $f cannot be read." 1>&2; exit 1; fi; LIB_LIST="$LIB_LIST $f" ; ;; esac; done if [ $EXPAND_ONLY = 1 ] then exit 0; fi; if [ $GEN_OBJ = 0 ] then exit 0; fi; #----------------------------------------- # Link edit object files. #----------------------------------------- if [ $LOAD = 1 ] then if [ $DEBUG = 1 ] then echo $LD $LD_OPT -o \ $AOUT $START $OBJ_LIST $LIB_LIST $SYS_LIBS $FORT_LIBS fi $LINK $LD_OPT -o $AOUT \ $START $OBJ_LIST $LIB_LIST $SYS_LIBS $FORT_LIBS fi ################### THE END OF SHELL SCRIPT f77 for RS/6000. ################# SHAR_EOF chmod +x 'f77' fi if test -f 'f77.1' then echo shar: "will not over-write existing file 'f77.1'" else cat << \SHAR_EOF > 'f77.1' .TH F77 1L "" "" .SH NAME f77 \- The \fIfortran\fR compiler Front-end for \fIXLF-FORTRAN/RS6000\fR .SH SYNOPSIS .B f77 [\fIoptions\fR] file ... .SH DESCRIPTION .PP .I f77 is a compiler front\-end very similar to the traditional \fIfortran\fR on \fIUNIX\fR, and much easier to use than \fIxlf\fR. Not only compiles the source code but also links the objects. .PP Source code has suffix `\fI.F\fR' is first processed by the `\fIcpp\fR' macro pre-processor as the \fIC\fR language. .PP The capability of the \fIC\fR macro expansion is quite powerful and convenient for debugging or modifying source code. And it also provides a nice way for writting codes in portable manner by absorbing the differences of the several systems. .SH OPTIONS SAME TO THE UNIX FORTRAN .PP .TP 14 \fB \-B\*\fP Change the base of the compiler. .TP 14 \fB \-c \fP The object file are not linked to an executable. .TP 14 \fB \-C \fP Gererate the object code for the runtime array subscript check. .TP 14 \fB \-D'\fImacroname\fR'\ \ \-D'\fImacroname=value\fR' \fP Define MACRO variable. .TP 14 \fB \-E \fP Output the macro expansion of `.F' files using \fIcpp\fR to \fIstdout\fR. .TP 14 \fB \-F \fP Make the macro expanded file `.f' from `.F' files using \fIcpp\fR. .TP 14 \fB \-g \fP Symbol table added to object for debugging using the `\fIdbx\fR'. .TP 14 \fB \-I'\fIdirname\fR' \fP Specify the directory for include file. .TP 14 \fB \-l\fIlibname\fR \fP Specify the standard library. (eg. -l\fIm\fR for /lib/lib\fIm\fR.a ) .TP 14 \fB \-L'\fIlibdirname\fR' \fP Specify the directory for the standard library. .TP 14 \fB \-N\fIxnnnn\fR \fP Enlarge the number of the compiler table size. B:nest of IF or DO block, C:constant, D:variable, N:bytes for names, P:subprogram, A:auxiliary table entry, Q:tokens, T:bytes for tokens, S:spill variable. .TP 14 \fB \-o\ '\fIexecutable_name\fR' \fP Specify the name of executable. .TP 14 \fB \-O \fP Optimize. ( Same as the options -O3 below. ) The default is no_optimize. .TP 14 \fB \-p \fP Generates the object code for profiling. .TP 14 \fB \-pg \fP Generates the object code for graph profiling. .TP 14 \fB \-q \fP Compile quietly. (Not implemented yet) .TP 14 \fB \-S \fP Output the pseudo (Pity!) assembler listing. (Sorry, be mixed into `.lst') .TP 14 \fB \-U \fP Distinguish upper and lower cases. .TP 14 \fB \-u \fP Force implicit undefined. .TP 14 \fB \-v \fP Verbose the compilation stage. .TP 14 \fB \-w \fP Suppress the warning messages. .TP 14 \fB \-1 \fP Execute the \fIDO-loop\fR at least once. .TP 14 \fB \-66 \fP Accepts \fIFORTRAN 66\fR feature. (Not implemented yet) .SH OPTIONS VALID ONLY FOR XLF-FORTRAN\/RS6000 .PP .TP 14 \fB \-ansi \fP Only \fIANSI-FIPS\fR syntax is accepted after the macro expansion. .TP 14 \fB \-compstat \fP Report compiler statistic ( `.lst' ). .TP 14 \fB \-debug \fP Debug the `\fIf77\fR' shell script. .TP 14 \fB \-dline \fP A line has D at the column 1 are compiled. (Not yet implemented.) .TP 14 \fB \-extchk \fP Procedure interface checking. .TP 14 \fB \-free \fP Accepts the free format source code of \fIXLF-FORTRAN\fR. .TP 14 \fB \-list \fP Source listing ( `.lst' ). .TP 14 \fB \-listopt \fP Output the option list ( `.lst' ). .TP 14 \fB \-map \fP Output the symbol map. (Not implemented yet.) .TP 14 \fB \-maxcharlen\ `\fInumber\fR' \fP Maximal charlength. (Default is 500.) .TP 14 \fB \-nofold \fP Ban constant float folding. .TP 14 \fB \-noextname \fP Stop adding underscore to external names in object. .TP 14 \fB \-noobj \fP No object file created. .TP 14 \fB \-nomaf \fP Avoid to use MAF instruction in object. .TP 14 \fB \-nouflow \fP Supress the exeption for the floating underflow. (Not implemented yet.) .TP 14 \fB \-N\? \fP Ask about the compiler table options. .TP 14 \fB \-O1\ \-O2\ \-O3 \fP Optimization level 1, 2, 3. .TP 14 \fB \-phaseinfo \fP Show the compiler phase timing. .TP 14 \fB \-Q* \fP Inline expansion control. .TP 14 \fB \-recursive \fP Allow recursive call of subprogram. .TP 14 \fB \-round\ [n|m|p|z] \fP Compile time round mode of const. n:nearest, m:to minus inf, p:to plus inf, z: to zero. (Default is nearest.) .TP 14 \fB \-single \fP Strict to the IEEE standard for single precision floating. .TP 14 \fB \-static \fP Variables become static as default. (Not implemented yet.) .TP 14 \fB \-symbol \fP Output the list of symbols and lines (sorry, mixed into ".lst"). .TP 14 \fB \-U'\fImacroname\fR' \fP Undefine MACRO variable. .TP 14 \fB \-xref \fP Output the cross reference table. (Sorry, be mixed into ".lst") .TP 14 \fB \-\# \fP Trace of the compiler. .SH FILE SUFFIX CONVENTIONS .PP .TP 14 \fB \.f \fP Normal \fIFORTRAN\fR souce file. .TP 14 \fB \.F \fP The \fIFORTRAN\fR source code to be first processed by macro `\fIcpp\fR'. The same syntax of the C macro can be used. .TP 14 \fB \.r \fP \fIRatfor\fR ( \fIrat\fRional \fIfor\fRtran ) source file. (Not supproted yet.) .TP 14 \fB \.s \fP Assembler source file. .TP 14 \fB \.o \fP Object file. .TP 14 \fB \.a \fP Object archive file. .TP 14 \fB \.lst \fP Listing output file. (\fIUNIX FORTRAN\fR has no correspondence.) .SH PRE-DEFINED MACRO VARIABLES .PP \fI"aiws", "unix", "aixpower", "RS6000", "IEEE", "NLS"\fR (Has effects only for ".F" files.) .SH AUTHOR .PP Hiroshi Murakami. .SH BUGS .PP The Author has no responsibility of any bug or inconvenience of the use of this front end command. This command is distributed without any warranty and support. Anyone may use or copy or modify this as free for his or her purpose, under the agreement that there is no garantree nor support for. This specification of the command may be changed without notice. SHAR_EOF fi if test -f 'f77cpp' then echo shar: "will not over-write existing file 'f77cpp'" else cat << \SHAR_EOF > 'f77cpp' : #! /bin/sh #ORIGINAL (USED BY SOME REASOM.) #CPP="/bin/cc -E -P -w -qflag=Q:Q" CPP="/lib/cpp -P" SED="/bin/sed" $CPP $* | $SED -e "/^#/d" -e "/^[ ]*$/d" SHAR_EOF chmod +x 'f77cpp' fi exit 0 # End of shell archive ------------------------------------ cut here ---------------------------------
Technical Details
Message-ID:
<1804@tansei1.tansei.cc.u-tokyo.ac.jp>Path:
arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ccut!yayoi!tansei1!mhiroshiShow Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS X-Google-Thread: 1070da,88245b6255ed3ad4,start X-Google-Attributes: gid1070da,public X-Google-ArrivalTime: 1992-03-07 02:53:11 PST Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ccut!yayoi!tansei1!mhiroshi From: mhiroshi@tansei.cc.u-tokyo.ac.jp (mhiroshi) Newsgroups: fj.sys.misc Subject: A f77 clone for IBM Power station (AIX). Message-ID: <1804@tansei1.tansei.cc.u-tokyo.ac.jp> Date: 7 Mar 92 10:53:11 GMT Sender: news@tansei.cc.u-tokyo.ac.jp Distribution: fj Organization: Computer Centre, University of Tokyo Lines: 556