开发者

how to make a library with libtool if there are sources with the same filename in several directories

I'm trying to compile a library using libtool. The problem is that I have several source files with the same filename in several directories. Because of the that, during autoreconf, libtoolize throws errors at me.

Basically, my filesystem layout is as follows:

src/
    Makefile.am
    file.cpp
    dir1/
        fil开发者_开发技巧e.cpp
        ...
    dir2/
        file.cpp
        ...

The Makefile.am is placed in the src/ directory and is called by the main Makefile.am using SUBDIRS = src. The contents are similar to the following:

libfoo_la_SOURCES =    \
    file.cpp        \
    dir1/file.cpp   \
    dir2/file.cpp   \
    ...

However, when doing autoreconf, I get an error:

src/Makefile.am: object `file.lo' created by `dir1/file.cpp' and `file.cpp'

How to solve that? I presume that I'll have to add a Makefile.am into each of the subdiectories. How to exactly do that? Google did not help to find the solution.


Even if you make that work in the build system, the static library will still be missing parts of the code as ar happily overwrites archive members with the same name.


The solution is to create convenience libtool libraries (prefix them noinst so they won't be installed) in each subdirectory and then link them to the final shared library.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜