(Disclaimer: I'm not familiar with Automake's Fortran support.  The
following is based on the assumption that Fortran compilers work
in a similar manner to C compilers).

On 2011-07-13 07:59 -0400, Jeff Squyres wrote:
> On Jul 12, 2011, at 12:23 PM, Dave Goodell wrote:
> > Is there a better way?  I really expected version 2 to work and was
> > surprised when it didn't.
> 
> I've always a) assumed that Automake doesn't have Fortran dependency
> analysis, and b) coped with it by adding explicit dependency rules
> myself (which is icky).  Something like this:
> 
> foo_SOURCES = foo.f bar.h
> foo.f: bar.h

Note that this isn't quite right: the source file does not actually
depend on the header.  Such a dependency would imply that if you update
the header file, the source file needs to be regenerated.  But what one
usually wants is for the *object* file to be regenerated when a header
is updated: IOW, the compiled object is what depends on the header, not
the source file itself.

So this would perhaps be better written as

  foo_obj = foo.$(OBJEXT) # might need to be foo.lo if using libtool.
  $(foo_obj): bar.h

Cheers,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)

Reply via email to