Difference between revisions of "F2c"
From Computer History Wiki
(New page: While not really a compiler, f2c is based on the UNIX FORTRAN compiler, but as it used the same backend as the C compiler, f2c emits C, which in turn can be compiled by the nat...) |
(f2c defaulted to some XSUM nonsense, so tell it to make f2c... ooops.) |
||
Line 8: | Line 8: | ||
Simply extract and run: | Simply extract and run: | ||
<pre> | <pre> | ||
− | make -f makefile.u | + | make -f makefile.u f2c |
</pre> | </pre> | ||
Revision as of 18:34, 14 April 2010
While not really a compiler, f2c is based on the UNIX FORTRAN compiler, but as it used the same backend as the C compiler, f2c emits C, which in turn can be compiled by the native compiler.
F2C can be downloaded from http://www.netlib.org/f2c/
installing
F2c is easy to install, you can download the source here: http://vpsland.superglobalmegacorp.com/install/f2c/f2c.tar.gz
Simply extract and run:
make -f makefile.u f2c
Then run:
cp f2c /usr/local/bin cp f2c.h /usr/local/include
If all went well you should have a f2c command.
Next you'll need to download and build the IO library http://vpsland.superglobalmegacorp.com/install/f2c/libf2c.zip
Simply extract and run:
make -f makefile.u
Then run:
cp libf2c.a /usr/local/lib
Now you should be able to build a simple FORTRAN program like this:
hello.f
program hello print *, 'Hello!' end
Then run:
bash-2.01$ f2c hello.f hello.f: MAIN hello: bash-2.01$ cc hello.c -lf2c -o hello bash-2.01$ file hello hello: Mach-O executable (for architecture m68k) not stripped bash-2.01$ ./hello Hello!