NAME fmkmf -- construct make file for Fortran 90 project SYNOPSIS fmkmf [-p searchpath] [-f90 f90command] [-l linkopts] [-sub] [-tag f90suffix] main.f90 DESCRIPTION The fmkmf shell and perl scripts constructs a make file for the Fortran 90 project whose main program is in the file given as the last command line argument. The make file is sent to stdout so you would probably use fmkmf like this: fmkmf main.f90 > makefile make The makefile generated has the correct dependencies to ensure that the source files are compiled in the correct order, i.e. the file containing the line "module foomodule" gets compiled before any file containing the line "use foomodule". OPTIONS The following options are supported. They must come before the name of the source file. -p fmkmf usually only looks at source files in the current directory. If is a colon-separated list (e.g. .:../bar:../baz) then fmkmf will look in all the directories in the list. -l The string will be put on the link command after all the object files. If it has spaces in, it will need double quotes round it. -sub The user doesn't need this option. fmkmf calls itself recursively and uses this option to tell whether it was called by a user or by an instance of itself. (This doesn't apply to the perl version, which does its recursion with a subroutine.) -tag fmkmf normally assumes that Fortran 90 source files are identified by the suffix .f90 . The -tag option makes it assume that they end in the string .. -f90 fmkmf normally assumes that Fortran 90 compiler is invoked by the command f90. The -f90 option makes it assume that the compiler is invoked by the command . If you use F, for example, your source files probably have names like foo.F and the compile command is F. In this case you would use $ fmkmf -tag F -f90 F main.F > makefile If you use F, but all your source files have names like foo.f90 (perhaps because you use another compiler as well), you would compile a single file with $ F -Xf90 foo.f90 In this case, you might use fmkmf like this: $ fmkmf -f90 "F -Xf90" main.f90 > makefile ENVIRONMENT VARIABLES fmkmf makes use of four environment variables: FMKMF_F90, FMKMF_LINKOPTS, FMKMF_SPATH and FMKMF_SFTAG. These can be used instead of the command line options -f90, -l, -p and -tag respectively. (Command line options override any of these environment variables that you may have set.) If you do $ export FMKMF_F90="F -Xf90" then any subsequent line like this: $ fmkmf main.f90 > makefile Will generate a makefile suitable for using F when your source files end in .f90 An additional environment variable, FMKMF_GREP, may need to be set to point to a version of grep which accepts the -q flag. On Suns, this is necessary: try export FMKMF_GREP=/usr/xpg4/bin/grep. This only applies to the shell version -- the perl version doesn't use grep. SEE ALSO f90(1), make(1) NOTES fmkmf will only generate a complete make file if all the subroutines and functions are in modules. (Of course, if you are using F, they have to be.) If there are files containing non-module subroutines you will have to edit the make file to add targets to compile them, and to add the resulting object files to the link step. The perl version is MUCH faster than the shell version. I'd switch to it at once if I were you. Future additions will only be made to the perl version. TODO Add a mechanism for generating dependencies on include files Add a mechanism for subroutines that are not in modules (Could make it useful for f77 as well as f90) Ditto for functions (Much harder.......). Thursday January 20 11:02:02 GMT 2000