Split FORTRAN90 Source Files

F90SPLIT is a FORTRAN90 program which reads a (simple) FORTRAN90 source code, and writes each routine to a separate file with an extension of ".f90".

Here, by "routine", we mean a chunk of text that begins with a BLOCKDATA, FUNCTION, MODULE, PROGRAM or SUBROUTINE unit and ends with an END statement.

This utility can be convenient when your goal is to create a UNIX "AR" archive of the compiled object code. By splitting your source code up, and compiling each routine separately, you end up with a library in which each compiled module is individual listed and replaceable.


f90split myprog.f90

Instead of the name of a single file, a pattern can be given, as in:

f90split sub*.f90
in which case each file whose name matches the pattern will be handled by the program.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


F90SPLIT is available in a C version and a FORTRAN90 version.

Related Data and Programs:

CATALOG, a C++ program which reads a C, C++, FORTRAN77 or FORTRAN90 program and prints every line that begins with a special index tag. If the program has been marked up expecting this convention, it is a handy way of making a table of contents of a program file.

EXTRACT, a FORTRAN90 program which extracts a subroutine, function or module by name from a FORTRAN file.

F77SPLIT, a C program which can split a FORTRAN77 file.

FIXCON, a FORTRAN90 program which reads a FORTRAN file using FORTRAN77 continuation statements, and makes a copy that uses FORTRAN90 continuation instead.

HTMLINDEX, a C++ program which reads a FORTRAN program and writes a skeleton HTML page describing it, assuming that each subroutine includes a '!!' or 'cc' description line.

INCLUDE_FILES, a FORTRAN90 program which reads a FORTRAN program with INCLUDE statements, and makes a copy with the indicated files included.

MODULE_MARK, a FORTRAN90 program which replaces bare "END" statements by "END (module name)" statements in a FORTRAN90 file.

Source Code:

Examples and Tests:

List of Routines:

You can go up one level to the FORTRAN90 source codes.

Last revised on 23 August 2011.