automake
[Top][All Lists]
Advanced

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

Re: Defining dependencies in Automake


From: Ralf Wildenhues
Subject: Re: Defining dependencies in Automake
Date: Wed, 23 Jun 2010 06:54:28 +0200
User-agent: Mutt/1.5.20 (2010-04-22)

Hello Sam,

first off, please don't multi-post to both autoconf and automake lists.
Thank you.

* Sam Silla wrote on Tue, Jun 22, 2010 at 05:41:24PM CEST:
> I have a Makefile.am file right now that looks like this:
> 
> lib_LIBRARIES = foo.a
> 
> foo_a_SOURCES = bar.F90 baz.F90
> 
> However, bar.F90 depends on several other Fortran files (x.F90, y.F90,
> z.F90).

I take it that you mean that bar.F90 includes x.F90 etc., which in turn
means that bar.o depends on x.F90 etc.

> I would like to set up Automake to rebuild bar.o if the source of
> one of these dependencies change.
> 
> I've been reading the GNU manuals for automake/autoconf and was unable to
> find an applicable solution to this. Thanks for reading.

Well, Makefile.am files are also (mostly) just makefiles.  So you should
be able to just define dependencies manually, like you would in a
makefile:
  bar.o: x.F90 y.F90 z.F90

or, a bit more portably,
  bar.$(OBJEXT): x.F90 y.F90 z.F90

There are two issues here you might want to be aware of though: first,
the object file name is meant to be an internal undocumented automake
detail.  That is, in practice automake might rename objects for various
reasons (presence of per-target flags, length limitations, ...).

Then, another issue is that, for targets you list explicitly in
Makefile.am, automake won't add its rules for this target, even if you
don't include an actual recipe but only prerequisites.  (This has a
couple of noninteresting reasons, one being that automake isn't always
smart enough to detect that you don't include recipe commands, another
that you might want to turn off commands.)  This doesn't apply here
since there will still be an inference rule .F90.$(OBJEXT) that will do
the work for you.

Finally, Automake really should add support for dependency tracking for
Fortran, preprocessed and modules.

Cheers,
Ralf



reply via email to

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