Scons: What is the purpose of FORTRAN * variables when creating Fortran?

What is the purpose of variables FORTRAN*

in Scons? The manpage describes these as the default settings for all Fortran versions. But as far as I can tell, in practice they are never used as specific variables for various dialects of Fortran always have priority ( F77*

, F90*

, F95*

).

Is there a way to change the mapping from file extensions to Fortran dialects so that some files are displayed by default instead?

+3


source to share


1 answer


Looking through the source SCons (especially Tool / FortranCommon.py), it seems that FORTRAN

is regarded as a dialect with F77

, F90

, F95

and F03

, not the parent they are. It appears that the variant of FORTRAN

the variables to be used for source files with the names .f

, .for

, .ftn

, .fpp

and .fpp

, although they may be overridden from the variables FORTRANFILESUFFIXES

and FORTRANPPFILESUFFIXES

.

The code that sets this up:

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 ​​for Fortran formatting variables like ( dialect

is the second variable passed to the function):



 env['%sCOM' % dialect]     = '$%s -o $TARGET -c $%sFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect)

      

Code that sets F77

, F90

, F95

etc., is very similar, for example:

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 for returning from one dialect to FORTRAN

. Each dialect (including FORTRAN

) is separate and displayed from the endings of the filenames that can be customized.

+3


source







All Articles