File: README.submodules

package info (click to toggle)
makedepf90 3.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 420 kB
  • sloc: ansic: 997; yacc: 356; lex: 224; makefile: 204; sh: 153
file content (44 lines) | stat: -rw-r--r-- 1,068 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Fortran 2008 adds a new feature, submodules.

These have the syntax:

```
module points
  type :: point
     real :: x, y
  end type point

  interface
     module function point_dist(a, b) result(distance)
       type(point), intent(in) :: a, b
       real :: distance
     end function point_dist
  end interface
end module points

submodule (points) points_a
contains
  module function point_dist(a, b) result(distance)
    type(point), intent(in) :: a, b
    real :: distance
    distance = sqrt((a%x - b%x)**2 + (a%y - b%y)**2)
  end function point_dist
end submodule points_a
```

where the submodule inherits from the module `points`.

When compiled with gfortran this results in files:
```
points.smod
points@points_a.smod
```

while when compiled with Flang / F18 or PGI Fortran, this results in:
``
points.mod
points-points_a.mod
```

So, makedepf90 presented with a submodule creates a dependency on the file parent.mod, where 'parent' is the name of
the parent module, as it cannot determine (with only one file) the source filename containing the module.