FORT77(1)

okay so this is fort77 from the Linux Programmer's Manual, section 1, and it's lowkey giving "compiler, but make it a transparent little shapeshifter" πŸ’… no cap, bestie, let's get into it.


πŸŽ€ NAME πŸŽ€

fort77 β€” invoke the f2c Fortran translator transparently, like a compiler. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

fort77 [-c] [-g] [-v] [-k] [-P] [-cpp] [f2c option ...]  [-L directory
...]  [gcc-option ...]  [link option ...]  [-O optlevel] [-o outfile]
[-s] [-w] [-Wx,arg1[,arg2]...]  file ...

🌸 DESCRIPTION 🌸

So the fort77 script invokes the f2c command transparently, which means you can literally just use it like a real Fortran compiler. iconic behaviour honestly 🫢. You can use it to compile Fortran, C and assembler code, and to link all of that up with the f2c libraries.

Here's the vibe check on what happens to your files, based on their names:

  • Files ending in .f get compiled as Fortran source files. πŸ“
  • Files ending in .P are passed through to f2c.
  • Files ending in .F get sent to the C preprocessor first β€” and that preprocessor is invoked as /lib/cpp -traditional.
  • Any switches you pass via -D get handed straight to the preprocessor.
  • If the translation works out (slay πŸ’…), the resulting C files get passed to cc so they can be turned into an object file.
  • Files ending in .c, .C, .cc, .i, .s, .S, .m, .cc or .cxx go directly to the GNU C compiler; peep gcc(1) for that.
  • Every other file gets passed to the linker.
yes, .cc really is in that list twice. it's in the original, we don't touch it, periodt. 😭

πŸ’… OPTIONS πŸ’…

  • -c β€” Supress linking and produce an object (.o) file from each source file.
  • -g β€” Include debugging information.
  • -v β€” Be verbose; supplying this twice will also tell the C compilers etc to be verbose. (double the -v, double the yapping πŸ”₯)
  • -k β€” Keep the C files generated by f2c around. no deleting the receipts bestie.
  • -cpp β€” Pass Fortran code through the C preprocessor, as if filenames ended in .F.
  • -P β€” Generate f2c .P files.
  • -Ldirectory β€” Include directory in the search for libraries in the final linking stage.
  • -o outfile β€” Send output to outfile.
  • -trapuv β€” Have f2c generate code to trap uninitialized values. πŸ‘€
  • -Wx,arg1[,arg2...] β€” Pass the argument[s] argi through to the subprocess x, where x can assume one of the following values: f for the f2c step, p for the preprocessing step, c for the C compiler, a for the assembler (this is actually passed to the C compiler, too), and l for the linker. As an example, defining a preprocessor constant for the C compilation step would be done with -Wc,-DUNIX=1. Specifying the -f option to f2c would be done via -Wf,-f.

✨ f2c option ✨

fort77 passes through almost all f2c options: -C, -U, -u, -a, -E, -h, -P, -R, -r, -z, -I2, -I4, -onetrip, -!c, -!l, -!P, -!R, -ext, -!bs, -W[n], -trapuv, -w8, -r8 and -w66.

🧚 gcc options 🧚

The following options are passed through to gcc: -f*, -W*, -U*, -A*, -m*, -S, -E, -v, -x, -pipe, -o, -I, -V, -b*, -p, -pg.

πŸ‘‘ linker option πŸ‘‘

The options passed to the linking stage are -static, -shared, -v, -V, and -symbolic.

tiny heads up: the synopsis up top also shows -O optlevel, -s and -w. iykyk 🫢

😭 BUGS 😭

  • To make debugging work, you need to set a breakpoint at MAIN__ before you start. do not skip this step, it's giving "why is nothing working" otherwise.
  • f2c β€” This script automatically supplies the -I. option to f2c. Older versions of f2c may not support this.
  • This script is for the interaction of gcc and f2c; using it with another compiler will probably require modification.
  • The fort77 script does not strictly conform to Posix.2, because it accepts long options with one leading slash. This is done for gcc compatibility.

πŸ¦„ SEE ALSO πŸ¦„

f2c(1), cc(1), as(1), ld(1)


πŸ’œ AUTHOR πŸ’œ

Thomas Koenig, ig25@rz.uni-karlsruhe.de


and that's the whole page, bestie πŸ’– this one comes from the Linux Programmer's Manual, dated Nov 1996, and it lives in section 1 as FORT77(1). go forth and translate some Fortran, you absolute icon πŸŒˆπŸ‘‘