Make dependencies issue
Erik Schnetter
schnetter@aei.mpg.de
Wed Aug 11 16:56:00 GMT 2004
-----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-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: f_depend_modules.pl
Type: application/x-perl
Size: 2385 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20040811/6ccc26e7/attachment.pl>
More information about the Fortran
mailing list