automake
[Top][All Lists]
Advanced

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

Re: Compilation order


From: Ralf Wildenhues
Subject: Re: Compilation order
Date: Mon, 29 Sep 2008 21:41:10 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello Alberto,

I see you have solved your specific problem; please allow me a couple of
general comments though:

* Alberto Luaces wrote on Mon, Sep 29, 2008 at 10:26:56AM CEST:
> 
> isn't it assured that the build of the objects listed on a Makefile.am is 
> made 
> in the order of the sources of that file?

No, that is not assured.  Well, that's not the whole truth, but anyway
the gist is that you shouldn't rely on it:

When run in parallel (-jN) mode, make doesn't guarantee any order of
rule execution except that implied by the dependency relations.

When not run in parallel mode, then make does consider prerequisites of
a target in the order listed, i.e., from left to right; it thus traverses
the dependency tree depth first.  However, since automake produces some
of those rules, you cannot fully control the order of the items listed
there.  AFAIK automake doesn't reorder items arbitrarily though.

> My problem is that this library has its source files split into several 
> subdirectories. My first attempt was to list the source files in order in the 
> SOURCES variable and to attach a VPATH declaration at the end of the file 
> containig the rest of the subdirectories. This compiled well, but 
> the "distcheck" target failed because the Makefile couldn't find the sources 
> that weren't on the main source directory.

Yeah, you practically can't use VPATH yourself, as automake already uses
it to list $(srcdir) in it.

> I then removed the VPATH statement and began to write the full path of every 
> source file:
> 
> libfoo_a_SOURCES = a.f90 $(srcdir)/A/b.f90 $(srcdir)/B/c.f90 ...

FWIW, why not
  libfoo_a_SOURCES = a.f90 A/b.f90 B/c.f90 ...

> I could also write a Makefile.am for every subdirectory, but I don't know if 
> this would be an overkill.

This should rarely be necessary.

Please note that, in order to use the subdir-objects mode with Fortran,
you need (yet unreleased) development Automake 1.11a.

Cheers,
Ralf




reply via email to

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