[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Module statically linked, and maintainer-clean rule
From: |
Vincent Torri |
Subject: |
Re: Module statically linked, and maintainer-clean rule |
Date: |
Sun, 28 Oct 2012 12:00:38 +0100 |
On Sun, Oct 28, 2012 at 11:57 AM, Stefano Lattarini
<address@hidden> wrote:
> On 10/28/2012 11:34 AM, Vincent Torri wrote:
>> Hey
>>
>> Our project build some modules as shared lib. We added the possibility
>> to statically link them to the library with autoconf. We then define
>> BUILD_STATIC automake conditionnal to select what we want. The tree
>> directories are:
>>
>> src/lib <--- where the lib is
>> src/module <-- where the module is.
>>
>> * in src/module/Makefile.am:
>>
>> if ! BUILD_STATIC
>>
>> pkg_LTLIBRARIES = module.la
>> module_la_SOURCES = foo.c
>>
>> else
>>
>> noinst_LTLIBRARIES = mylib_module.la
>> mylib_module_la_SOURCES = foo.c
>>
>> endif
>>
>> * and in src/lib/Makefile.am
>>
>> if BUILD_STATIC
>>
>> SUBDIRS += ../module
>>
> Yikes! Recursing into a sibling directory, rather than just children
> ones, is asking for problems IMO.
>
>> mylib_la_LIBADD += ../module/mylib_module.la
>>
>> endif
>>
>> It works well, until I use the maintainer-clean rule. Indeed, because
>> of the SUBDIRS in src/lib/Makefile.am, maintainer-clean is launched
>> twice, hence an error as there is no Makefile anymore in src/module
>> when the 2nd maintainer-clean rule is executed.
>>
>> I also tried this in src/lib/Makefile.am:
>>
>> if BUILD_STATIC
>>
>> mylib_la_SOURCES += ../module/foo.c
>>
>> endif
>>
>> but then same kind of error, with foo.Plo in src/module/.deps when the
>> 2nd maintainer-clean rule is launched : that file does not exist
>> anymore
>>
>> Does someone know what I have to do ?
>>
> My advice: re-organize your build system to avoid recursive make
> invocations where not actually necessary.
that's the second version above in src/lib/Makefile.am : I add to
mylib_la_SOURCES the file that is in another directory, so no
SUBDIRS,right ?
Vincent Torri