Skip to content

Commit

Permalink
Handle Fortran sources with dependencies to themselves.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Aug 8, 2014
1 parent f3d0778 commit 1b830c9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,11 @@ def get_fortran_deps(self, compiler, src, target):
raise InvalidArguments('Module %s in file %s not provided by any other source file.' %
(usename, src))
mod_source_file = tdeps[usename]
# Check if a source uses a module it exports itself.
# Potential bug if multiple targets have a file with
# the same name.
if mod_source_file == os.path.split(src)[1]:
continue
# WORKAROUND, we should set up a file level dependency to the
# module file and mark it as an output of this target. However
# we can't do that as Ninja does not support dependency tracking
Expand Down
4 changes: 4 additions & 0 deletions test cases/fortran/4 self dependency/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
project('selfdep', 'fortran')

e = executable('selfdep', 'selfdep.f90')
test('selfdep', e)
11 changes: 11 additions & 0 deletions test cases/fortran/4 self dependency/selfdep.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
MODULE Circle
REAL, PARAMETER :: Pi = 3.1415927
REAL :: radius
END MODULE Circle

PROGRAM prog

use Circle
IMPLICIT NONE

END PROGRAM prog

0 comments on commit 1b830c9

Please sign in to comment.