[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fortran 77 header dependencies
From: |
Dave Goodell |
Subject: |
Re: fortran 77 header dependencies |
Date: |
Wed, 13 Jul 2011 12:50:30 -0500 |
On Jul 13, 2011, at 9:43 AM CDT, Nick Bowler wrote:
> 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
Your correction of Jeff's solution made me realize that my "version 3" solution
is wrong. It expresses a foo-->bar.h dependency instead of foo.o-->bar.h
dependency. Your approach is what I was looking for. Unfortunately this
solution gets even uglier looking if foo has any per-target flags such as
"foo_FFLAGS=-I.".
-Dave