FOURNIER Yvan
2017-01-10 10:47:51 UTC
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
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