[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Module statically linked, and maintainer-clean rule
From: |
Stefano Lattarini |
Subject: |
Re: Module statically linked, and maintainer-clean rule |
Date: |
Sun, 28 Oct 2012 11:57:17 +0100 |
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.
After all, your modules and library seems interrelated enough that
keeping their build separated into tow sub-systems is artificial,
and a recipe for problems.
HTH,
Stefano