[Scons-users] ifort (maybe general Fortran): Module directory issues

Dirk Bächle tshortik at gmx.de
Thu Mar 27 13:41:18 EDT 2014


Hi Markus,

On 27.03.2014 16:03, Markus Hrywniak wrote:

> Hi everybody,

>

> [...]

>

> $ scons -Q

> ifort -o build/bar.o -c -module build -module src src/bar.f90

> ifort -o build/foo.o -c -module build -module src src/foo.f90

>

> Note that the first option is what I set, and the second one is added

> automatically as soon as I set "duplicate=0". This overrides the first

> invocation and causes all .mod files to be placed into src/.

> Contrarily, if I remove the switch or set "duplicate=1", no extra

> -module directive appears.

>

> I think I see the logic behind this: "If we do an out-of-tree build

> and do not copy the sources, usually the .mod files will be at the

> same place as the source files, so let's add it to the search path".

> This would work fine if the order were reversed or turned off in the

> presence of a user-supplied module path (i.e. FORTRANMODDIR variable).

>


the environment variable responsible for adding the "-module" keywords
to the compiler call, is just defined this way. It always adds the
"source" dirs for each variant directory, too.
You should be able to suppress this, by redefining the variable in
question after the Fortran tool was initialized:

env = Environment()
env['_FORTRANMODFLAG'] = '$( ${_concat(FORTRANMODDIRPREFIX,
FORTRANMODDIR, FORTRANMODDIRSUFFIX, __env__, lambda x: x, TARGET,
SOURCE)} $)'

Then only the directory you specified via FORTRANMODDIR should get added
to the command line (untested).
Hope this helps...

Best regards,

Dirk



More information about the Scons-users mailing list