I'd like to draw your attention to the following problem:

There is one thing the autoconf/automake support for Fortran 77
is currently lacking: dependency tracking like for C/C++.

First of all, an automake-generated makefile refuses to work 
if there is no C source file specified in Makefile.am (only Fortran
source files). The reason is that the Makefile contains dependencies
on .deps/whatever.Po which doesn't exist, but has no rule for generating
these. Once a single C source file exists in the same directory, the
problem disappears. I have not understood the dependency tracking code
for C/C++ well enough yet to fix this.

Second, if the Fortran/cpp code became part of autoconf, it would be
relatively easy to track Fortran dependencies resulting from cpp #include
statements. Basically, the same approach as for C/C++ could be used (g77
supports -MM and -MD, and fpp supports -M with very similar
outcome. "makedepend" also works with Fortran input files). 

Unfortunately, that approach doesn't work for Fortran INCLUDE statements,
and I have not yet found a tool that parses such statements like
e.g. makedepend parses #include's. It would be relatively simple to
provide e.g. a simple perl script taking care of this. 
Such a script, however, would only recognize basic syntax.

The following code:

      I   Nclu D    e
     1                                                            'i3.in
     2c'

which is valid Fortran 77 syntax for including a file called 'i3.inc',
would certainly not recognized by a simple script, which would probably
parse for something like 
^ *[iI][nN][cC][lL][uU][dD][eE] *["']\(.*\)["']

In order to do it right (so that any valid Fortran INCLUDE be
recognized), one would need (almost) a fully-fledged Fortran parser,
and I cowardly refuse to start writing one (I have considered stripping
down the parsers of either f2c or g77, but even that looks like a huge
amount of work).

Could anyone comment on 

- whether such a thing like Fortran dependency tracking is desirable at
  all in automake/autoconf,

- if yes, which solution we should go for ?

Regards,
Martin

P.S. This problem seems to be trivial compared to providing dependency
     tracking support for Fortran 90 modules. But that's a different
     issue...

-- 
Martin Wilck <[EMAIL PROTECTED]>
Institute for Tropospheric Research, Permoserstr. 15, D-04318 Leipzig, Germany
Tel. +49-341-2352151 / Fax +49-341-2352361


Reply via email to