summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorDirk Baechle <dl9obn@darc.de>2015-01-10 11:10:51 (GMT)
committerDirk Baechle <dl9obn@darc.de>2015-01-10 11:10:51 (GMT)
commitb1bacbc9334e22ca08b6b090ea2029164ae945bb (patch)
tree94391d42b7d25522e79ab9dd7348d100f18d1f6f /src/engine
parente544a59d8cf297b36b69582c661e9558a124d4e5 (diff)
parent4d45e513c90ddeb3b93c44c2264258aa44b7b36b (diff)
downloadSCons-b1bacbc9334e22ca08b6b090ea2029164ae945bb.zip
SCons-b1bacbc9334e22ca08b6b090ea2029164ae945bb.tar.gz
SCons-b1bacbc9334e22ca08b6b090ea2029164ae945bb.tar.bz2
Merged in russel/scons (pull request #203), update Fortran tooling to support .f08 file extensions"
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/Tool/FortranCommon.py16
-rw-r--r--src/engine/SCons/Tool/f08.py63
-rw-r--r--src/engine/SCons/Tool/f08.xml311
-rw-r--r--src/engine/SCons/Tool/gfortran.py2
4 files changed, 391 insertions, 1 deletions
diff --git a/src/engine/SCons/Tool/FortranCommon.py b/src/engine/SCons/Tool/FortranCommon.py
index 4c5730c..2df2a32 100644
--- a/src/engine/SCons/Tool/FortranCommon.py
+++ b/src/engine/SCons/Tool/FortranCommon.py
@@ -247,6 +247,21 @@ def add_f03_to_env(env):
DialectAddToEnv(env, "F03", F03Suffixes, F03PPSuffixes,
support_module = 1)
+def add_f08_to_env(env):
+ """Add Builders and construction variables for f08 to an Environment."""
+ try:
+ F08Suffixes = env['F08FILESUFFIXES']
+ except KeyError:
+ F08Suffixes = ['.f08']
+
+ try:
+ F08PPSuffixes = env['F08PPFILESUFFIXES']
+ except KeyError:
+ F08PPSuffixes = []
+
+ DialectAddToEnv(env, "F08", F08Suffixes, F08PPSuffixes,
+ support_module = 1)
+
def add_all_to_env(env):
"""Add builders and construction variables for all supported fortran
dialects."""
@@ -255,6 +270,7 @@ def add_all_to_env(env):
add_f90_to_env(env)
add_f95_to_env(env)
add_f03_to_env(env)
+ add_f08_to_env(env)
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Tool/f08.py b/src/engine/SCons/Tool/f08.py
new file mode 100644
index 0000000..a45a61d
--- /dev/null
+++ b/src/engine/SCons/Tool/f08.py
@@ -0,0 +1,63 @@
+"""engine.SCons.Tool.f08
+
+Tool-specific initialization for the generic Posix f08 Fortran compiler.
+
+There normally shouldn't be any need to import this module directly.
+It will usually be imported through the generic SCons.Tool.Tool()
+selection method.
+
+"""
+
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import SCons.Defaults
+import SCons.Tool
+import SCons.Util
+import fortran
+from SCons.Tool.FortranCommon import add_all_to_env, add_f08_to_env
+
+compilers = ['f08']
+
+def generate(env):
+ add_all_to_env(env)
+ add_f08_to_env(env)
+
+ fcomp = env.Detect(compilers) or 'f08'
+ env['F08'] = fcomp
+ env['SHF08'] = fcomp
+
+ env['FORTRAN'] = fcomp
+ env['SHFORTRAN'] = fcomp
+
+
+def exists(env):
+ return env.Detect(compilers)
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:
diff --git a/src/engine/SCons/Tool/f08.xml b/src/engine/SCons/Tool/f08.xml
new file mode 100644
index 0000000..6a49c75
--- /dev/null
+++ b/src/engine/SCons/Tool/f08.xml
@@ -0,0 +1,311 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+__COPYRIGHT__
+
+This file is processed by the bin/SConsDoc.py module.
+See its __doc__ string for a discussion of the format.
+-->
+
+<!DOCTYPE sconsdoc [
+<!ENTITY % scons SYSTEM '../../../../doc/scons.mod'>
+%scons;
+<!ENTITY % builders-mod SYSTEM '../../../../doc/generated/builders.mod'>
+%builders-mod;
+<!ENTITY % functions-mod SYSTEM '../../../../doc/generated/functions.mod'>
+%functions-mod;
+<!ENTITY % tools-mod SYSTEM '../../../../doc/generated/tools.mod'>
+%tools-mod;
+<!ENTITY % variables-mod SYSTEM '../../../../doc/generated/variables.mod'>
+%variables-mod;
+]>
+
+<sconsdoc xmlns="http://www.scons.org/dbxsd/v1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd">
+
+<tool name="f08">
+<summary>
+<para>
+Set construction variables for generic POSIX Fortran 08 compilers.
+</para>
+</summary>
+<sets>
+<item>F08</item>
+<item>F08FLAGS</item>
+<item>F08COM</item>
+<item>F08PPCOM</item>
+<item>SHF08</item>
+<item>SHF08FLAGS</item>
+<item>SHF08COM</item>
+<item>SHF08PPCOM</item>
+<item>_F08INCFLAGS</item>
+</sets>
+<uses>
+<item>F08COMSTR</item>
+<item>F08PPCOMSTR</item>
+<item>SHF08COMSTR</item>
+<item>SHF08PPCOMSTR</item>
+</uses>
+</tool>
+
+<cvar name="F08">
+<summary>
+<para>
+The Fortran 08 compiler.
+You should normally set the &cv-link-FORTRAN; variable,
+which specifies the default Fortran compiler
+for all Fortran versions.
+You only need to set &cv-link-F08; if you need to use a specific compiler
+or compiler version for Fortran 08 files.
+</para>
+</summary>
+</cvar>
+
+<cvar name="F08COM">
+<summary>
+<para>
+The command line used to compile a Fortran 08 source file to an object file.
+You only need to set &cv-link-F08COM; if you need to use a specific
+command line for Fortran 08 files.
+You should normally set the &cv-link-FORTRANCOM; variable,
+which specifies the default command line
+for all Fortran versions.
+</para>
+</summary>
+</cvar>
+
+<cvar name="F08COMSTR">
+<summary>
+<para>
+The string displayed when a Fortran 08 source file
+is compiled to an object file.
+If this is not set, then &cv-link-F08COM; or &cv-link-FORTRANCOM;
+(the command line) is displayed.
+</para>
+</summary>
+</cvar>
+
+<cvar name="F08FILESUFFIXES">
+<summary>
+<para>
+The list of file extensions for which the F08 dialect will be used. By
+default, this is ['.f08']
+</para>
+</summary>
+</cvar>
+
+<cvar name="F08PPFILESUFFIXES">
+<summary>
+<para>
+The list of file extensions for which the compilation + preprocessor pass for
+F08 dialect will be used. By default, this is empty
+</para>
+</summary>
+</cvar>
+
+<cvar name="F08FLAGS">
+<summary>
+<para>
+General user-specified options that are passed to the Fortran 08 compiler.
+Note that this variable does
+<emphasis>not</emphasis>
+contain
+<option>-I</option>
+(or similar) include search path options
+that scons generates automatically from &cv-link-F08PATH;.
+See
+&cv-link-_F08INCFLAGS;
+below,
+for the variable that expands to those options.
+You only need to set &cv-link-F08FLAGS; if you need to define specific
+user options for Fortran 08 files.
+You should normally set the &cv-link-FORTRANFLAGS; variable,
+which specifies the user-specified options
+passed to the default Fortran compiler
+for all Fortran versions.
+</para>
+</summary>
+</cvar>
+
+<cvar name="_F08INCFLAGS">
+<summary>
+<para>
+An automatically-generated construction variable
+containing the Fortran 08 compiler command-line options
+for specifying directories to be searched for include files.
+The value of &cv-link-_F08INCFLAGS; is created
+by appending &cv-link-INCPREFIX; and &cv-link-INCSUFFIX;
+to the beginning and end
+of each directory in &cv-link-F08PATH;.
+</para>
+</summary>
+</cvar>
+
+<cvar name="F08PATH">
+<summary>
+<para>
+The list of directories that the Fortran 08 compiler will search for include
+directories. The implicit dependency scanner will search these
+directories for include files. Don't explicitly put include directory
+arguments in &cv-link-F08FLAGS; because the result will be non-portable
+and the directories will not be searched by the dependency scanner. Note:
+directory names in &cv-link-F08PATH; will be looked-up relative to the SConscript
+directory when they are used in a command. To force
+&scons;
+to look-up a directory relative to the root of the source tree use #:
+You only need to set &cv-link-F08PATH; if you need to define a specific
+include path for Fortran 08 files.
+You should normally set the &cv-link-FORTRANPATH; variable,
+which specifies the include path
+for the default Fortran compiler
+for all Fortran versions.
+</para>
+
+<example_commands>
+env = Environment(F08PATH='#/include')
+</example_commands>
+
+<para>
+The directory look-up can also be forced using the
+&Dir;()
+function:
+</para>
+
+<example_commands>
+include = Dir('include')
+env = Environment(F08PATH=include)
+</example_commands>
+
+<para>
+The directory list will be added to command lines
+through the automatically-generated
+&cv-link-_F08INCFLAGS;
+construction variable,
+which is constructed by
+appending the values of the
+&cv-link-INCPREFIX; and &cv-link-INCSUFFIX;
+construction variables
+to the beginning and end
+of each directory in &cv-link-F08PATH;.
+Any command lines you define that need
+the F08PATH directory list should
+include &cv-link-_F08INCFLAGS;:
+</para>
+
+<example_commands>
+env = Environment(F08COM="my_compiler $_F08INCFLAGS -c -o $TARGET $SOURCE")
+</example_commands>
+</summary>
+</cvar>
+
+<cvar name="F08PPCOM">
+<summary>
+<para>
+The command line used to compile a Fortran 08 source file to an object file
+after first running the file through the C preprocessor.
+Any options specified in the &cv-link-F08FLAGS; and &cv-link-CPPFLAGS; construction variables
+are included on this command line.
+You only need to set &cv-link-F08PPCOM; if you need to use a specific
+C-preprocessor command line for Fortran 08 files.
+You should normally set the &cv-link-FORTRANPPCOM; variable,
+which specifies the default C-preprocessor command line
+for all Fortran versions.
+</para>
+</summary>
+</cvar>
+
+<cvar name="F08PPCOMSTR">
+<summary>
+<para>
+The string displayed when a Fortran 08 source file
+is compiled to an object file
+after first running the file through the C preprocessor.
+If this is not set, then &cv-link-F08PPCOM; or &cv-link-FORTRANPPCOM;
+(the command line) is displayed.
+</para>
+</summary>
+</cvar>
+
+<cvar name="SHF08">
+<summary>
+<para>
+The Fortran 08 compiler used for generating shared-library objects.
+You should normally set the &cv-link-SHFORTRAN; variable,
+which specifies the default Fortran compiler
+for all Fortran versions.
+You only need to set &cv-link-SHF08; if you need to use a specific compiler
+or compiler version for Fortran 08 files.
+</para>
+</summary>
+</cvar>
+
+<cvar name="SHF08COM">
+<summary>
+<para>
+The command line used to compile a Fortran 08 source file
+to a shared-library object file.
+You only need to set &cv-link-SHF08COM; if you need to use a specific
+command line for Fortran 08 files.
+You should normally set the &cv-link-SHFORTRANCOM; variable,
+which specifies the default command line
+for all Fortran versions.
+</para>
+</summary>
+</cvar>
+
+<cvar name="SHF08COMSTR">
+<summary>
+<para>
+The string displayed when a Fortran 08 source file
+is compiled to a shared-library object file.
+If this is not set, then &cv-link-SHF08COM; or &cv-link-SHFORTRANCOM;
+(the command line) is displayed.
+</para>
+</summary>
+</cvar>
+
+<cvar name="SHF08FLAGS">
+<summary>
+<para>
+Options that are passed to the Fortran 08 compiler
+to generated shared-library objects.
+You only need to set &cv-link-SHF08FLAGS; if you need to define specific
+user options for Fortran 08 files.
+You should normally set the &cv-link-SHFORTRANFLAGS; variable,
+which specifies the user-specified options
+passed to the default Fortran compiler
+for all Fortran versions.
+</para>
+</summary>
+</cvar>
+
+<cvar name="SHF08PPCOM">
+<summary>
+<para>
+The command line used to compile a Fortran 08 source file to a
+shared-library object file
+after first running the file through the C preprocessor.
+Any options specified in the &cv-link-SHF08FLAGS; and &cv-link-CPPFLAGS; construction variables
+are included on this command line.
+You only need to set &cv-link-SHF08PPCOM; if you need to use a specific
+C-preprocessor command line for Fortran 08 files.
+You should normally set the &cv-link-SHFORTRANPPCOM; variable,
+which specifies the default C-preprocessor command line
+for all Fortran versions.
+</para>
+</summary>
+</cvar>
+
+<cvar name="SHF08PPCOMSTR">
+<summary>
+<para>
+The string displayed when a Fortran 08 source file
+is compiled to a shared-library object file
+after first running the file through the C preprocessor.
+If this is not set, then &cv-link-SHF08PPCOM; or &cv-link-SHFORTRANPPCOM;
+(the command line) is displayed.
+</para>
+</summary>
+</cvar>
+
+</sconsdoc>
diff --git a/src/engine/SCons/Tool/gfortran.py b/src/engine/SCons/Tool/gfortran.py
index 4f3e7e4..392a92e 100644
--- a/src/engine/SCons/Tool/gfortran.py
+++ b/src/engine/SCons/Tool/gfortran.py
@@ -43,7 +43,7 @@ def generate(env):
Environment."""
fortran.generate(env)
- for dialect in ['F77', 'F90', 'FORTRAN', 'F95', 'F03']:
+ for dialect in ['F77', 'F90', 'FORTRAN', 'F95', 'F03', 'F08']:
env['%s' % dialect] = 'gfortran'
env['SH%s' % dialect] = '$%s' % dialect
if env['PLATFORM'] in ['cygwin', 'win32']: