[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why configure script says to link this library with LIBADD instead o

From: Dale E Martin
Subject: Re: Why configure script says to link this library with LIBADD instead of LDADD?
Date: Tue, 29 Apr 2003 07:30:37 -0400
User-agent: Mutt/1.3.28i

> Try either of these instead:
>   myprogram_LDADD = ../lib/libmynoinstlib.a
> Or:
>   myprogram_LDADD = $(top_builddir)/lib/libmynoinstlib.a

I would HIGHLY recommend the second form here, and I'd also highly
recommend refering to source files using $(top_srcdir)/path/to/source.
Someday you or someone wanting to use your software will want to use VPATH
builds and if you use the second style above, it should be possible.

If you're not aware of VPATH builds, it's when you build outside of your
source tree.  For example, say I have some sources in "foo/src".  I can do
this to build if I want:
cd foo/src
autoreconf -i
cd /tmp
make install

This will cause foo to build and install, without putting any .o files in
the foo/src directory.  Why would I want to do this?  One reason I do it is
to be able to build with both g++ 2.95 and 3.2 on the same source tree
before I ever check files into CVS.  Other people do it to cross compile to
multiple targets on the same source.  You could also do it to
enable/disable different configure time options on the same tree and make
sure the combinations work as you develop.

Anyways, I think the $(top_builddir) and $(top_srcdir) stuff is essential
when you need to reference things "across" your source archive.

Take care,
Dale E. Martin, Clifton Labs, Inc.
Senior Computer Engineer
pgp key available

reply via email to

[Prev in Thread] Current Thread [Next in Thread]