[patch, fortran] output of Makefile dependencies

Tobias Burnus burnus@net-b.de
Sun Jun 13 14:10:00 GMT 2010


Hi Daniel,

Daniel Franke wrote:
> Attached patch enables the output of Makefile dependencies.
> It handles '#include', 'INCLUDE' and module targets/use dependencies alike.
>   

Awesome!

I glanced at the patch - and I like it. However:

a) You need to change invoke.texi, it still lists -M as (deprecated)
synonym for -J.


b) gfortran.texi lists:
  @item
  Flag to generate @code{Makefile} info.
You should remove it.
(By the way, the "Proposed Extensions" and "Fortran 2003 and 2008
status" sections need to be updated badly.)


c) The patch does not work properly.

Assume: The file "iso_c_env.mod" exists, omp_lib.mod and 
omp_lib_kinds.mod do not

-------- x/other.f90 ------------
module m
  integer :: a
end module m

integer :: b
common /com/ b

-------- inc.f90 ------------
 include "other.f90"
end

subroutine test
  use, intrinsic :: iso_c_binding
  use, non_intrinsic :: iso_c_env
  use OMP_LIB
  use OMP_LIB_KINDS
end subroutine test
---------------------------------

$ gfortran -cpp -I./x -M inc.f90
inc.o m.mod: inc.f90 other.f90 iso_c_binding.mod iso_c_env.mod \
 omp_lib.mod omp_lib_kinds.mod


Expected:

- other.f90 misses the path "./x" in the name (it works for #include
"other.f90").

- The intrinsic modules "iso_c_binding.mod", "omp_lib.mod", and
"omp_lib_kinds.mod" shall not be listed - only the non_intrinsic module
"iso_c_env.mod".

- If possible: If - for instance - the "omp_lib.mod" file exists, add it
to the list as the standard has
"A use-stmt without a module-nature provides access either to an
intrinsic or to a nonintrinsic module. If the module-name is the name of
both an intrinsic and a nonintrinsic module, the nonintrinsic module is
accessed."
If the check can not easily be done, I think one can simply assume that
the intrinsic module is meant - which is the most likely case.

- Related to that: "use mod". If the module does not exist, "mod.mod"
would be OK, but if the file "x/mod.mod" exists, it probably should be
used. Again, as written above: If the check is difficult, simply output
"mod.mod".

Tobias



More information about the Gcc-patches mailing list