LF Fortran 95

Multi-Phase Compilation

Sometimes, more than one compilation phase is required. For example, if source files are stored in more than one directory, you will need a separate compilation phase for each directory. Multiple phases are also required if you have mixed C and Fortran source, or if you need special compilation options for particular source files.

The 'AND ' keyword may be inserted in your configuration file to add a new compilation phase. You can reset the values of FILES= , COMPILE= , INCLUDE= , OBJDIR= , OBJEXT= and MODULE= for each phase. All default to the value used in the previous phase, except that OBJDIR= defaults to the new source directory.

The following example shows how this feature might be used with the LF95 compiler. The same principles apply to other compilers and other platforms.

# Example Configuration file for Multi-Phase 
# Compilation
# Compilation 1 - files in current directory
LF95
INCLUDE=\include
FILES=*.f90
OBJDIR=obj
COMPILE=@lf95 -c %fi -i %id -o %od%sf%oe -tp -o1
AND
# Compilation 2 - files in utils\
# INCLUDE= defaults to previous value (\include)
# if OBJDIR= were not set, it would default to utils (NOT obj)
FILES=utils\*.f90
OBJDIR=utils\obj
COMPILE=@lf95 -c %fi -i %id -o %od%sf%oe -sav -chk
# Relink
TARGET=current.exe
LINK=@lf95 %ob -out %ex