On Thu, Dec 15, 2011 at 10:31 PM, Stefano Lattarini < [email protected]> wrote:
> On Thursday 15 December 2011, ittium wrote: > > Group, > > I have a Makefile.am which is building a executable. This executable > > depends on certain libraries. I want to put these libraries as > dependencies > > to the executable so that when library got build, executable is also > built > > (if build from top level dir), I have many tried some option from net e.g > > specifying "LIBRARY=" variable, none is working. Please let me know, how > to > > do this. > > thanks > > Ittium > > > Something like this should work: > > lib_LIBRARIES = libfoo.a > bin_PROGRAMS = bar > bar_LDADD = libfoo.a > > or better again, in case your library is only useful to build your program > and is not meant to be installed: > > noinst_LIBRARIES = libfoo.a > bin_PROGRAMS = bar > bar_LDADD = libfoo.a > > For more information about the use of LDADD, see also: > > <http://www.gnu.org/software/automake/manual/automake.html#Linking> > > HTH, > Stefano > thanks Stefano, I think, I could not explain the issue clearly. I have a build system which build libraries followed by some binaries (libraries and binaries reside in different directories), these binaries link with libraries earlier built. If I change some source file in library, library will be recompiled. What I want is when make file for executable find out some library has changed, It should relink automatically on calling make. bin_PROGRAMS=fooclient fooserver fooclient_SOURCES=source/foo_client_main.cpp fooserver_SOURCES=source/foo_server_main.cpp INCLUDES=-I./include fooclient_LDADD=-L$(ROOT_DIR)/protocol_handlers/net_handler fooserver_LDADD=-L$(ROOT_DIR)/protocol_handlers/net_handler In above case if any of the library mentioned in LDADD (here libnet_handler.a) change, I want automatic relinking of binaries assuming source files for binary have not changed
