>>> "Baurjan" == Baurjan Ismagulov <[EMAIL PROTECTED]> writes:

 Baurjan> On Mon, Mar 07, 2005 at 02:27:25PM +0100, Nicolas Joly wrote:
 >> > AUTOMAKE_OPTIONS = dejagnu
 >> > bin_PROGRAMS = zzz
 >> > noinst_PROGRAMS = test1 test2 test3
 >> > noinst_LTLIBRARIES = libzzz.la
 >> > zzz_SOURCES = zzz.c
 >> > libzzz_la_SOURCES = a/a.c b/b.c
 >> > AM_CFLAGS = -g -Wall -std=c99 -I$(top_srcdir)/include @ZZZ_CFLAGS@ 
 >> > -DSYSCONFDIR=\"@[EMAIL PROTECTED]"
 >> > zzz_LDADD = @ZZZ_LIBS@ $(top_builddir)/libzzz.la
 >> > test1_LDADD = @ZZZ_LIBS@ $(top_builddir)/libzzz.la
 >> > test2_LDADD = @ZZZ_LIBS@ $(top_builddir)/libzzz.la
 >> > test3_LDADD = @ZZZ_LIBS@ $(top_builddir)/libzzz.la

1) since libzzz.la is referenced as `libzzz.la' in noinst_LTLIBRARIES,
  a) it is built built is the current directory
  b) you should reference it as `libzzz.la' anywhere else in the same 
     Makefile (BSD Make is not able to guess that ./libzzz.la is the 
     same file as libzzz.la, for instance).
So all these $(top_builddir)/libzzz.la really should be libzzz.la.

2) the `LDADD' variable contains the default definition for
all *_LDADD variables.  So linking all you programs against the
same libraries requires only one line (LDADD = $(ZZZ_LIBS) libzzz.la)

 Baurjan> I haven't found a way of specifying dependencies between different
 Baurjan> makefiles. I've reverted to a single Makefile.am and specified the
 Baurjan> dependencies manually, like this:

 Baurjan> zzz_DEPENDENCIES = libzzz.la
 Baurjan> test1_DEPENDENCIES = libzzz.la
 Baurjan> test2_DEPENDENCIES = libzzz.la
 Baurjan> test3_DEPENDENCIES = libzzz.la

When you write 

 zzz_LDADD = $(ZZZ_LIBS) libzzz.la

automake generates 

 zzz_DEPENDENCIES = libzzz.la

automatically.  

 Baurjan> Is there a way to specify that binaries should depend
 Baurjan> on the libraries they are linked with (i.e., that a
 Baurjan> general LDADD implies general DEPENDENCIES or
 Baurjan> generates the respective dependencies automatically)?

This is what happens.
-- 
Alexandre Duret-Lutz



Reply via email to