automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Manual dependency: specifying config.h on Automake.am


From: Stefano Lattarini
Subject: Re: Manual dependency: specifying config.h on Automake.am
Date: Fri, 02 Mar 2012 20:51:58 +0100

On 03/01/2012 03:22 PM, Fabrício Zimmerer Murta wrote:
> Hello,
>
Hello Fabrício, sorry for the delay.

>  I am unable to use automatic dependency tracking as I have been doing
>  a project in Fortran 90.  My problem is: when I change include/config.h,
>  src/*.F90 which have the include/ file "included" are not recompiled
>  (as would be expected).
>
Unfortunately, such an expectation is not warranted, since automatic
dependency tracking does not work with Fortran sources (this is a
long-standing automake limitation).

>  I wonder if it would be okay just to add to the Makefile rules
>  the "../include/config.h"
>
Yes, that should be OK.  The slightly more tricky thing is to determine to
which object files this dependency should be added ...  Ideally, if you have
something like:

  bin_PROGRAMS = prog1 prog2
  prog1_SOURCES = foo.F90 bar.F90
  prog2_SOURCES = a.F90 b.F90 c.F90

then something like this should work:

  $(prog1_OBJECTS) $(prog2_OBJECTS): ../include/config.h

But beware: this code is "cheating" and using internal automake-generated
make variables ($(prog1_OBJECTS), $(prog2_OBJECTS)) which are not documented
and for which no backward-compatibility is ensured (even if it's highly
unlikely they are going to be changed).

For previous discussion on similar issues, you can take a look at this
thread:

 <http://lists.gnu.org/archive/html/automake/2010-08/msg00056.html>

> or if there’s a better way to express this dependency as
>       (a) all files depend on include/config.h
>
Good, then the above workaround shouldn't cause unnecessary rebuilds!

>       (b) compiles on different paths could break if they look for
>           files inside ../include relative path.
>
The workaround above does not alter the search path used by you compilers
for include files, so you should be safe on this front.

>     Thank you, I am sorry if this is a too dumb question,
>
It's most definitely not :-)

> I am a newbie on GNU Build System indeed. :)
> 
> - fabricio

HTH,
  Stefano



reply via email to

[Prev in Thread] Current Thread [Next in Thread]