Reputation: 85
What is the purpose of the FORTRAN*
variables in Scons? The manpage describes them as the default settings for all versions of Fortran. But as far as I can tell, in practice they are never used because the specific variables for the different Fortran dialects that always take precedence (F77*
, F90*
, F95*
).
Is there a way to change the mapping from file extensions to Fortran dialects, so that some files get mapped to the default instead?
Upvotes: 4
Views: 137
Reputation: 6915
Looking through the SCons source (particularly Tool/FortranCommon.py) it appears the that FORTRAN
is treated as a dialect along with F77
, F90
, F95
and F03
rather than a parent to all of them. It looks like the FORTRAN
variant of the variables will be used for source files named with .f
, .for
, .ftn
, .fpp
, and .FPP
though they can be overridden from the variables FORTRANFILESUFFIXES
and FORTRANPPFILESUFFIXES
.
The code that sets this up is:
def add_fortran_to_env(env):
"""Add Builders and construction variables for Fortran to an Environment."""
try:
FortranSuffixes = env['FORTRANFILESUFFIXES']
except KeyError:
FortranSuffixes = ['.f', '.for', '.ftn']
#print "Adding %s to fortran suffixes" % FortranSuffixes
try:
FortranPPSuffixes = env['FORTRANPPFILESUFFIXES']
except KeyError:
FortranPPSuffixes = ['.fpp', '.FPP']
DialectAddToEnv(env, "FORTRAN", FortranSuffixes,
FortranPPSuffixes, support_module = 1)
where DialectAddToEnv
gives values to the Fortran build variables, e.g (dialect
is the second variable passed to to the function):
env['%sCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect)
The code that sets up F77
, F90
, F95
, etc is very similar, e.g.:
def add_f90_to_env(env):
"""Add Builders and construction variables for f90 to an Environment."""
try:
F90Suffixes = env['F90FILESUFFIXES']
except KeyError:
F90Suffixes = ['.f90']
#print "Adding %s to f90 suffixes" % F90Suffixes
try:
F90PPSuffixes = env['F90PPFILESUFFIXES']
except KeyError:
F90PPSuffixes = []
DialectAddToEnv(env, "F90", F90Suffixes, F90PPSuffixes,
support_module = 1)
There is no mechanism to fall back from one dialect to FORTRAN
. Each dialect (including FORTRAN
) is separate and mapped from the file name endings, which are configurable.
Upvotes: 4