automake
[Top][All Lists]
Advanced

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

Re: Copying build results to another directory


From: Richard Carlson
Subject: Re: Copying build results to another directory
Date: Fri, 27 Jul 2001 10:38:39 -0700 (PDT)

Tom,

> Why do you want to copy things around during the build?
> Why not just use them where they lie?

During a build, I'm moving the following around :

programs copied to $(top_builddir)/bin
libraries copied to $(top_builddir)/lib
headers copied to $(top_builddir)/include

This means that for a program named 'foo', I can link with the libraries
named 'bar1', 'bar2, and 'bar3' like this:

LIBS        = -L$(top_srcdir)/lib
foo_LDADD   = -lbar1 -lbar2 -lbar3

If I used them where they lay, I'd have to write something like this:

foo_LDADD = $(top_srcdir)/src/lib/bar1/bar1.la \
            $(top_srcdir)/src/lib/bar1/bar2.la \
            $(top_srcdir)/src/lib/bar1/bar3.la \

Which would require all those hard coded paths.  

Thanks a ton for your help,

Richard

On 26 Jul 2001, Tom Tromey wrote:

> >>>>> "Richard" == Richard Carlson <address@hidden> writes:
> 
> Richard> Makefile.am:
> Richard> noinst_PROGRAMS = hello
> Richard> hello_SOURCES = hello.c
> 
> Try something like this:
> 
> all-local: hello
>       cp hello someplace
> 
> Richard>      cp -p hello $(top_srcdir)/bin
> 
> In general you don't want to put anything in srcdir.
> You particularly don't want to copy an executable there.
> Instead use $(top_builddir).
> 
> Richard> The problem with this is that I'd like the binary to be
> Richard> copied when I solely build 'hello', as in "make hello".
> 
> There's no really good way to do this.
> 
> You can make it work by introducing your own `hello' target which
> does the link itself and then does the copy.
> 
> Or you can name the executable differently in the build tree:
> 
> noinst_PROGRAMS = hellox
> hellox_SOURCES = hello.c
> 
> all-local: hello
> 
> hello: hellox
>       cp hellox $(top_builddir)/bin/hello
> 
> 
> Why do you want to copy things around during the build?
> Why not just use them where they lie?
> 
> Tom
> 




reply via email to

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