> and I want a Makefile.am in the top-level source directory that > compiles main1.c and main2.c into one library (say libmain.la) and > mod1.c and mod2.c into libmod.la in the modules directory. Simple > request huh? But in *one* Makefile.am. How do I do it? > > This doesn't do the job: > lib_LTLIBRARIES = libmain.la modules/libmod.la > libmain_la_SOURCES = main1.c main2.c > libmod_la_SOURCES = modules/mod1.c modules/mod2.c
Hi, Did you mean: modules_libmod_la_SOURCES = ... ? You said "... libmod.la in the modules directory." > libtool doesn't like directory names in the lib_LTLIBRARIES variable. > But if I go ... > > > lib_LTLIBRARIES = libmain.la libmod.la and modules/libmod.la? > ...then everything gets built in the top-level directory and I don't > want that. > > > Can anyone help? My only work-around at present is to have a separate > Makefile in the modules sub-directory, but that won't work anymore > because I'm building a binary in the top-level Makefile that depends on > both earlier libraries, while libmod also depends on libmain, i.e. > > > binary -> depends on modules/libmod.la and libmain.la > modules/libmod.la -> depends on libmain.la > > > If I use separate Makefiles, I'm going to need three to get around the > dependencies and to get the build order right, and that's going to get > ugly. David Fang