On Friday 16 December 2011, ittium  wrote:
>
> thanks Stefano, I think, I could not explain the issue clearly.
>
No, you did explain yourself quite clearly and correctly, but I have
probably been too much terse in my answer.  Let's see whether I've done
better this time ...

> 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.
>
I had understood your use case quite correctly then.

> bin_PROGRAMS=fooclient fooserver
> fooclient_SOURCES=source/foo_client_main.cpp
> fooserver_SOURCES=source/foo_server_main.cpp
> INCLUDES=-I./include

Question: what is the expected value of $(ROOT_DIR) below? 

> fooclient_LDADD=-L$(ROOT_DIR)/protocol_handlers/net_handler
> fooserver_LDADD=-L$(ROOT_DIR)/protocol_handlers/net_handler
>
Ah-ah, you are using `-L' in fooserver_LDADD.  This might be what is
causing your problem.  In fact, the documentation I had linked in my
previous reply reads:

  prog_LDADD is inappropriate for passing program-specific linker
  flags (except for -l, -L, -dlopen and -dlpreopen). So, use the
  prog_LDFLAGS variable for this purpose.

> 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
>
Try to use this:

   fooclient_LDADD = $(ROOT_DIR)/protocol_handlers/libnet_handler.a
   fooserver_LDADD = $(ROOT_DIR)/protocol_handlers/libnet_handler.a

Then the relinking you want to see should happen automatically (and
this should work even if $(ROOT_DIR) is defined at configure time
rather than at automake time, BTW).  If this doesn't happen, than I
have misunderstood something, or you have found a bug in automake;
in any case, let me know, and we'll try to work out the problem.

Regards,
  Stefano

Reply via email to