* Michel Briand wrote on Wed, Feb 04, 2009 at 10:33:34AM CET: > Ralf Wildenhues <[email protected]> - Tue, 3 Feb 2009 19:06:52 +0100 > > > >If you're using Automake, then you're probably looking for the Automake > >option subdir-objects, which causes objects to put in directories along > >the subdir of the source files provided.
> I put the sub-objects into my AM_INIT_AUTOMAKE. It works like you > explained. Thanks. But why does it's not the default behavior ? Oh, the reason for that is probably portability issues in tools from years ago. I can only speculate, but old make implementations probably had less than spectacular support for the VPATH feature with files that have directory components. Solaris 2.6 make for example is quite broken that way. Another issue is that more compilers existed which did not support being passed both -c and -o, thus having the object file placed in the current directory was in a sense "more natural". > Furthermore I noted that .o files are twice for one source file: Well, that is "normal" for objects that are being put into libraries: one object is compiled with position-independent code, one without. Jan already noted this. It shouldn't happen for objects that only end up in programs though. For example, with this: bin_PROGRAMS = foo lib_LTLIBRARIES = libbar.la foo_SOURCES = foo.c libbar_la_SOURCES = bar.c only bar.c will be compiled twice, but not foo.c. With convenience archives, objects are created twice because they may end up being incorporated into libraries later. Hope that helps. Cheers, Ralf
