From: [EMAIL PROTECTED] > 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