Difficulty handling specific case with subdir-objects in VPATH build

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Difficulty handling specific case with subdir-objects in VPATH build

FOURNIER Yvan
Hello,

I am trying to update a build system using recursive Automake Makefiles so as to
remove Automake2 compatibilty warnings (and make it compatible with Automake 2
when that comes out).

Simply adding subdir-objects to AM_INIT_AUTOMAKE in configure.ac works for most
cases, but fails completely in a specific section explicitely handling
subdirectories:

In a software tool containing several sub-libraries and executables, we have a
mix of Fortran and C codes in the main module's source directory (it is the
Code_Saturne CFD code, distributed under the GPL licence, which may be found at
code-saturne.org)

The organization of the relevant scection is basically of the form:

root
  src
    subdir1
    subdir2
    ...

As different subdirectories contain Fortran modules whose dependencies can not
be automatically tracked by Automake, the workaround we have used so far
consisted of:

-  Adding a target (libcsmodules_la_SOURCES in the attached Makefile.am)
containing explicit rules and dependencies for the Fortran module files, and
adding "." in the beginning of the SUBDIRS section of that same file. This uses
relative paths, such as $(top_srcdir)/src/base/paramx.f90.

This way, under a VPATH build, this first target would ensure compilation of the
specified paths in their matching locations (i.e.
$(top_srcdir)/src/base/paramx.f90 would lead to
$(top_builddir)/src/base/paramx.lo), and the rest of the libraries could then be
compiled normally.

Adding "subdir-objects" seems to cause this to fail. In the "$(top_builddir)src"
directory, I now get a message telling me there is no rule to build paramx.lo...

Also, the generated Makefile.in is suspicious, as the matching
am_libcsmodules_la_OBJECTS target contains references such as:
$(top_srcdir)/src/base/paramx.lo while I am doing an out-of-tree (VPATH) build,
and I would expect $(top_builddir) instead of $(top_srcdir).

Without "subdir-objects", I get the desired behavior with Automake.

Is this a bug in the "subdir-objects" implementation, or a desired feature ?
The documentation seems very minimalist, and I could find nothing relevant to
this in the Automake documentation.

Is there a workaround (besides moving to a non-recursive build, which would
require a much larger effort) ?

Best regards,

        Yvan Fournier





Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme à sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse.

Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez reçu ce Message par erreur, merci de le supprimer de votre système, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions également d'en avertir immédiatement l'expéditeur par retour du message.

Il est impossible de garantir que les communications par messagerie électronique arrivent en temps utile, sont sécurisées ou dénuées de toute erreur ou virus.
____________________________________________________

This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval.

If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message.

E-mail communication cannot be guaranteed to be timely secure, error or virus-free.

Makefile.am (9K) Download Attachment
Makefile.in (68K) Download Attachment