From: Tobias Burnus on
On Apr 24, 4:28 am, zhaoping...(a)gmail.com wrote:
> gcc -MM x.cpp can create header file dependent for CPP
> so I try gfortran -MM x.for ,but I got nothing
> even when I use gfortran -M x.for ,I got Segmentation fault

Well, at some point "-M directory" was added to specify where the .mod
file should be written to (by default it is written in the current
directory). Someone realized then that GCC uses the option to generate
dependency files and added "-J directory" as replacement for "-M".
(See gfortran documentation.) "-M directory" is currently still
supported but depreciated.

Support for writing the depending information (with -M) is planed for
the near future (next few months, i.e. 4.4.0) and the first patches
leading to this have already been posted. Thus the answer is: No,
currently, gfortran (up to the current developer version) cannot
generate the dependency information, but in a few months gfortran
4.4.0 might support it.

Tobias

PS: This is tracked in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31588;
ignore that there last comment was quite some time ago, it is really
been worked on. At the moment the task is to better support the C
preprocessor (cpp), which is needed to fix some feature
requests/"bugs" but also to support "#include" for the make-file
dependency generation. See for instance the following, 12 hours old
patch, which is currently still unreviewed and mentions your -M with
explicitly as TODO item: http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01753.html

PPS: g95 supports the generation of makefile dependency information;
you could use g95 as work around until gfortran has implemented it.
From: zhaopingsun on
On 4ÔÂ24ÈÕ, ÏÂÎç3ʱ37·Ö, Tobias Burnus <bur...(a)net-b..de> wrote:
> On Apr 24, 4:28 am, zhaoping...(a)gmail.com wrote:
>
> > gcc -MM x.cpp can create header file dependent for CPP
> > so I try gfortran -MM x.for ,but I got nothing
> > even when I use gfortran -M x.for ,I got Segmentation fault
>
> Well, at some point "-M directory" was added to specify where the .mod
> file should be written to (by default it is written in the current
> directory). Someone realized then that GCC uses the option to generate
> dependency files and added "-J directory" as replacement for "-M".
> (See gfortran documentation.) "-M directory" is currently still
> supported but depreciated.
>
> Support for writing the depending information (with -M) is planed for
> the near future (next few months, i.e. 4.4.0) and the first patches
> leading to this have already been posted. Thus the answer is: No,
> currently, gfortran (up to the current developer version) cannot
> generate the dependency information, but in a few months gfortran
> 4.4.0 might support it.
>
> Tobias
>
> PS: This is tracked inhttp://gcc.gnu.org/bugzilla/show_bug.cgi?id=31588;
> ignore that there last comment was quite some time ago, it is really
> been worked on. At the moment the task is to better support the C
> preprocessor (cpp), which is needed to fix some feature
> requests/"bugs" but also to support "#include" for the make-file
> dependency generation. See for instance the following, 12 hours old
> patch, which is currently still unreviewed and mentions your -M with
> explicitly as TODO item:http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01753..html
>
> PPS: g95 supports the generation of makefile dependency information;
> you could use g95 as work around until gfortran has implemented it.

thanks for your reply, I have spent 10 minutes to write a small perl
script to do it , although far from perfect ,it's good enough for me ,
then waiting for 4.4 released.:)

From: zhaopingsun on
On 4ÔÂ24ÈÕ, ÏÂÎç3ʱ37·Ö, Tobias Burnus <bur...(a)net-b..de> wrote:
> On Apr 24, 4:28 am, zhaoping...(a)gmail.com wrote:
>
> > gcc -MM x.cpp can create header file dependent for CPP
> > so I try gfortran -MM x.for ,but I got nothing
> > even when I use gfortran -M x.for ,I got Segmentation fault
>
> Well, at some point "-M directory" was added to specify where the .mod
> file should be written to (by default it is written in the current
> directory). Someone realized then that GCC uses the option to generate
> dependency files and added "-J directory" as replacement for "-M".
> (See gfortran documentation.) "-M directory" is currently still
> supported but depreciated.
>
> Support for writing the depending information (with -M) is planed for
> the near future (next few months, i.e. 4.4.0) and the first patches
> leading to this have already been posted. Thus the answer is: No,
> currently, gfortran (up to the current developer version) cannot
> generate the dependency information, but in a few months gfortran
> 4.4.0 might support it.
>
> Tobias
>
> PS: This is tracked inhttp://gcc.gnu.org/bugzilla/show_bug.cgi?id=31588;
> ignore that there last comment was quite some time ago, it is really
> been worked on. At the moment the task is to better support the C
> preprocessor (cpp), which is needed to fix some feature
> requests/"bugs" but also to support "#include" for the make-file
> dependency generation. See for instance the following, 12 hours old
> patch, which is currently still unreviewed and mentions your -M with
> explicitly as TODO item:http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01753..html
>
> PPS: g95 supports the generation of makefile dependency information;
> you could use g95 as work around until gfortran has implemented it.

thanks for your reply, I have spent 10 minutes to write a small perl
script to do it , although far from perfect ,it's good enough for me ,
then waiting for 4.4 released.:)