Re: support for F90/F95 in SCons
From: Chris Murray (murpup_at_comcast.net)
Date: 08/21/04
- Next message: James Van Buskirk: "Re: Fortran Newbie - Where to start?"
- Previous message: Ken Plotkin: "Re: How to understand another's program?"
- In reply to: Michael Prager: "Re: support for F90/F95 in SCons"
- Next in thread: Douglas Cox: "Re: support for F90/F95 in SCons"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 20 Aug 2004 22:49:45 -0400
Michael Prager wrote:
> Chris Murray <murpup@comcast.net> wrote:
>
>
>>Michael Prager wrote:
>>
>>
>>>In article <Db2dndMJy85QlbncRVn-sw@comcast.com>, Chris Murray
>>>wrote:
>>>
>
> [...]
>
>>>If anyone has a working Fortran example (especially one that
>>>does NOT assume the Fortran compiler is invoked with 'f77',
>>>please post it.
>>>
>>
>>Well, the following would be a very basic example of a mixed-language
>>project being compiled. I have not verified that it works because it is
>>boiled down from a much larger script that I know does work, but all the
>>basic elements are there. Really, only the last line is truly needed if
>>you are willing to pass Program an explicit list of source file names.
>>If they have a .f90 extension, scons should be smart enough to call
>>'f90' to compile them. .f and .f77 extensions would by default, get
>>compiled with 'f77', but this is overrideable. [...]
>
>
> Right, the question is HOW to override it. A quick look through
> the documentation and search for "fortran," "compiler", and
> similar things didn't turn up anything. The information may be
> there, but it's hard to find.
>
> In my test, scons was using "f77" as the compile command for
> files ending in ".f90". I need to be able to specify what
> string to use. I imagine that is possible in the SConstruct
> file, but how?
>
>
Check out the FORTRAN* construction variables. If you search the man
page for FORTRAN, F90, F95, F77, you'll see all the various construction
variables that you can set in an environment. Unless you have a project
in which you are calling different fortran compilers for source files
that conform to different standards, the recommended practice is to
simply use the FORTRAN construction variables as the means for
overriding the defaults built in to SCons. SCons is supposed to just
'do the right thing'. The caveat is that SCons does not automatically
inherit your environment like make does (in order to ensure correct
builds independent of user-environment), so it won't necessarily know
where to find compilers that may be in your path. If SCons can't find
an executable like 'f90' to compile a .f90 file, it will just default to
f77. You can import specific environment variables into an SCons
construction environment (use env.Append()) or set env['FORTRAN']
specifically (as you might set $F90 in a makefile). So to tell SCons to
use a command called 'lf95' for example (the lahey compiler), you would
need a line in your SConstruct something akin to this
env = Environment() # Instantiates a construction environment
env['FORTRAN'] = '/usr/lf95/bin/lf95' # Path to a fortran compiler exe
- Next message: James Van Buskirk: "Re: Fortran Newbie - Where to start?"
- Previous message: Ken Plotkin: "Re: How to understand another's program?"
- In reply to: Michael Prager: "Re: support for F90/F95 in SCons"
- Next in thread: Douglas Cox: "Re: support for F90/F95 in SCons"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|