automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Conditional Library Compilation


From: Drummonds, Scott B
Subject: RE: Conditional Library Compilation
Date: Tue, 3 Feb 2004 10:44:15 -0800

From: address@hidden 
> One possibility:
> 
> noinst_LIBRARIES = libfoo.a
> libfoo_a_SOURCES = foo.c bar.c
> 
> if FEATURE
> noinst_LIBRARIES += libMyLib.a
> libMyLIB_a_CPPFLAGS = -DMyLibExtraFlags
> libMyLib_a_SOURCES = $(libfoo_a_SOURCES)
> endif

This seems to suffer from the same problem as my previous configuration.
When FEATURE is defined, the code enclosed in the conditional above does
appear in the Makefile.  But, it appears very late in the file so the
addition of libMyLib.a to noinst_LIBRARIES occurs after several
expansions of that variable.  As such, there are several targets that
reference $noinst_LIBRARIES before it has been augmented with
libMyLib.a.  Therefore, the additional library is not being built.

I thought that maybe I could put this condition before noinst_LIBRARIES
was initially set then change that assignment to an append operation
(+=), but then I cannot reference $libMyLib_a_SOURCES to get the source
files for libMyLib.a.  I suppose I could use a temporary variable for
this but then my Makefile.am is starting to get a little convoluted.
There has to be an easier way!

Any other ideas?

Scott




reply via email to

[Prev in Thread] Current Thread [Next in Thread]