ftnmgen

Date:

04-22-2016

NAME

ftnmgen - Invokes the Fortran makefile generator

SYNOPSIS

ftnmgen
[-a]
[-c compiler]
[-f flags]
[-m makefile]
[-o command_name]
files

IMPLEMENTATION

Cray Linux Environment (CLE)

DESCRIPTION

The ftnmgen utility splits out all Fortran subroutines from files by using the ftnsplit(1) utility and produces a makefile that may be used to compile and load a program. Optionally, by using the -a option, ftnmgen can create a file-based makefile, the creation of which does not use ftnsplit to split the files. The ftnmgen utility inserts dependency rules for include files and module usage. See the EXAMPLES section of this man page for a sample makefile that illustrates these rules.

The ftnmgen utility accepts the following options:

-a

Creates a file-based makefile that does not use ftnsplit to split the source file.

-c compiler

Specifies the Fortran compiling system used to convert the .f files to .o files (ftn by default) and link them to form an executable file.

-f flags

Specifies options to the Fortran compiling system. Enclose the argument specifying the option(s) in single quotation marks.

-m makefile

Specifies the name of the makefile produced by the ftnmgen utility (makefile by default).

-o command_name

Specifies the resultant executable file (a.out by default).

files

Specifies the names of input files.

Makefiles created by ftnmgen have the following targets:

all

Creates the executable file command_name (default rule).

command_name

Compiles and loads the program.

clean

Removes all .o files.

clobber

Executes clean and then removes the executable files.

void

Removes everything created by the ftnmgen utility.

Caution:

  • If you use the -a option to create the makefile, your original source files will also be removed.

NOTES

ftnmgen uses the ftnsplit utility to split files and to provide module and include file dependency analysis.

ftnmgen module dependency analysis can go only one level deep. That is, if A uses B, which in turn uses C, then a make dependency only between A and B can be planted. This allows for showing dependencies between B and C but is not sufficient to allow A to show dependencies on B and C.

EXAMPLES

The following example shows how to specify that the ftn command in the makefile uses the -I../ and -v flags when compiling the Fortran source code files:

ftnmgen -f '-I../ -v' fort1.f fort2.f fort3.f

The following command line and code fragments illustrate dependency rules:

ftnmgen -a file.f harry.f

file.f is:

program fred
use harry
include "jim.h"

end program fred

harry.f is:

module harry

end module harry

The example command line creates a makefile containing the following rules:

file.o:  harry.o
file.o:  jim.h

In this example, if you had not specified harry.f on the ftnmgen command line, the makefile would display the following message:

file.o:  ** NEED MODULE FILE FOR:  harry **

This result would force you to hand edit the makefile.

FILES

makefile

Default make file created

a.out

Default executable binary file name

file.extension,

Input Fortran source code file

  • Fortran source files on Cray systems may have any of these suffixes: .f, .F, .for, .FOR, .f90, .F90, .f95, .F95, .f03, .F03, .f08, .F08, .ftn, or .FTN. File names having the following suffixes are generated by the preprocessor: .F, .FOR, .F90, .F95, .F03, .F08, or .FTN.

file.o

Relocatable object code file

SEE ALSO

crayftn(1), make(1)