This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Make dependencies issue


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 11 August 2004 18:39, Ben Robinson wrote:
> Hello,
>
> Where can I find a free program that will function like "gcc -MM -MG"
> but for Fortran77/90?  I need to automatically build the list of file
> dependencies for make so I don't need to recompile everything when I
> change a header file.
>
> I tried "g77 -M" and the compiler doesn't complain about an invalid
> switch but no output is produced.

It depends on what kind of include statements you use.  I prefer to use 
CPP style includes, i.e.

	#include "yada.inc"

and "cpp -traditional" is, together with the corresponding -M arguments 
(presumably the same as for gcc), good for producing makefile 
fragments.

If you use Fortran include statements or Fortran use statements, then it 
is probably only the Fortran compiler itself that knows about the 
dependencies.  This is among other things because the Fortran 
compiler's include search path might be completely different form the C 
preprocessor's include search path.  I don't have a good solution for 
that, except a perl script that I wrote for that purpose and which 
works in the context of the Cactus toolkit (www.cactuscode.org), so it 
is probably not of much use to you...  I'll append it anyway.  It 
should be called as

f_depend_modules.pl <source-file> <object-file> 
<directory-of-source-file> <list-of-include-directories>

(all on one line, of course).  As a goodie, it interprets the C 
preprocessors line directives, so that its error messages point to the 
correct place.

This might be a starting point for a dependency script of your.  This 
script is LGPL.

- -erik

- -- 
Erik Schnetter <schnetter@aei.mpg.de>   http://www.aei.mpg.de/~eschnett/

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from www.keyserver.net.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBGk+km3uiSwno3f0RAg1oAJ9JDE4QCX+0MtR80yN3wJfXQbxkjwCgqo55
NYiXiHJQpgM5zV/Cst+PFGU=
=e2lP
-----END PGP SIGNATURE-----

Attachment: f_depend_modules.pl
Description: Perl program


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]