[mfu2: [EMAIL PROTECTED] >>> "Bill" == Bill Moseley <[EMAIL PROTECTED]> writes:
[...] Bill> I've tried to read all the docs (a few times), but it's Bill> still not clear for me. If there are specific parts of the manual that you think should be augmented or clarified, please report them. This will help everybody. [...] Bill> My existing configure.in script checks for libxml2 and then sets: Bill> AC_DEFINE(HAVE_LIBXML2,[],[libxml support]) Bill> LIBXML2_OBJS="parser.lo" Bill> AC_SUBST(LIBXML2_OBJS) Bill> AC_SUBST(LIBXML2_LIB) Bill> AC_SUBST(LIBXML2_CFLAGS) Bill> The last two are set from xml2-config --libs and --cflags commands. Bill> I use parser.lo because I'm building with libtool, but I'm not sure if Bill> that's the correct method. Bill> So, what I'm trying is: Bill> AM_CPPFLAGS = @LIBXML2_CFLAGS@ @Z_CFLAGS@ Bill> [other library and binary built in this Makefile.am snipped] Bill> noinst_LTLIBRARIES = libswishindex.la Bill> libswishindex_la_LIBADD = @LIBXML2_LIB@ @LIBXML2_OBJS@ sw_expat/libswexpat.la Bill> libswishindex_la_DEPENDENCIES = @LIBXML2_OBJS@ Bill> ##libswishindex_la_LDADD = @LIBXML2_OBJS@ Bill> EXTRA_libswishindex_la_SOURCES = parser.c parser.h Bill> libswishindex_la_SOURCES = \ Bill> fs.c fs.h \ Bill> http.c http.h \ Bill> ... $(LIBXML2_LIB) -- nowadays we prefer this syntax over @LIBXML2_LIB@ -- should probably go into libswishindex_la_LDFLAGS, not _LIBADD. Bill> Automake is telling me to use LIBADD not LDADD although I was trying to Bill> follow the example on page 43 of the Autoconf book -- I still don't get Bill> the difference between LDADD and LIBADD. LIBADD is for libraries and LDADD is for binaries. That's all. Bill> So, basically: Bill> - I want to conditionally add -lxml2 and the CPPFLAGS and the parser.o Bill> module in only that one convenience library. I guess it doesn't hurt Bill> that AM_CPPFLAGS adds the flags to the other library build, but it would Bill> seem best to add them just when building parser.o. For conditional sources, see http://sources.redhat.com/automake/automake.html#Conditional%20Sources (what applies to programs applies to libraries as well once you change LDADD into LIBADD). To set per-library CPPFLAGS and LDFLAGS, use libswishindex_la_LDFLAGS and libswishindex_la_CPPFLAGS. These are documented here. http://sources.redhat.com/automake/automake.html#Program%20and%20Library%20Variables There is now way to have per-object flags (yet). Unless you compile this single object as a convenient library and use per-library flags. Bill> - I do not understand what the DEPENDENCIES entry does, Bill> if anything. Is that needed? The way you achieve conditional compilation, yes. You do want libswishindex.la to be rebuilt when parser.c changes, don't you? The first URL above shows a second approach that does not require playing with ugly stuff like _DEPENDENCIES or `.lo'. Maybe I'll prefer that. Bill> By the way, how can I force the complete rebuiding of just one Bill> (convenience) library without rebuilding everything? You can use sub-directories to make partial cleaning easier or write your own clean rule. I fail to see why you want to do that, though (hidden dependencies?) -- Alexandre Duret-Lutz
