[Scons-users] Fortran dependency in a higher directory

Bill Deegan bill at baddogconsulting.com
Thu Apr 5 13:36:09 EDT 2018


Take a look at:
http://scons.org/doc/production/HTML/scons-man.html#cv-FORTRANPATH


On Thu, Apr 5, 2018 at 9:01 AM, GUEZ Lionel <guez at lmd.ens.fr> wrote:

> Hello. Consider the following test files.
>
> $ cat foo.f
> module foo_m
>   implicit none
>   integer i
> contains
>   subroutine foo
>     i = 3
>   end subroutine foo
> end module foo_m
>
> $ cat Subdir/bar.f
> module bar_m
>   implicit none
> contains
>   subroutine bar
>     use foo_m, only: i
>     print *, "bar"
>     print *, "i = ", i
>   end subroutine bar
> end module bar_m
>
> $ cat SConstruct
> Object(["Subdir/bar.f", "foo.f"], FORTRANFLAGS = "-ffree-form")
>
> So I have a Fortran file bar.f in directory Subdir which depends on a
> Fortran file in the directory above Subdir. Now I try to compile this:
>
> $ scons
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> gfortran -o Subdir/bar.o -c -ffree-form Subdir/bar.f
> Subdir/bar.f:5:8:
>
>      use foo_m, only: i
>         1
> Fatal Error: Can't open module file 'foo_m.mod' for reading at (1): No
>      such file or directory
> compilation terminated.
> scons: *** [Subdir/bar.o] Error 1
> scons: building terminated because of errors.
>
> Scons has not figured out the dependency. It has not begun with the
> compilation of foo.f, as it should have. What is the simplest way to
> make this work?
>
> --
> Lionel GUEZ
> Laboratoire de météorologie dynamique
> École normale supérieure
> 24 rue Lhomond
> 75005 Paris
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180405/6cf0d2de/attachment-0001.html>


More information about the Scons-users mailing list