[Scons-users] Fortran dependency in a higher directory
GUEZ Lionel
guez at lmd.ens.fr
Thu Apr 5 12:01:32 EDT 2018
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
More information about the Scons-users
mailing list