automake
[Top][All Lists]
Advanced

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

Re: Defining variables shared between Makefile.am files


From: Ralf Wildenhues
Subject: Re: Defining variables shared between Makefile.am files
Date: Wed, 30 Sep 2009 07:46:22 +0200
User-agent: Mutt/1.5.20 (2009-08-09)

* vicious3030 wrote on Tue, Sep 29, 2009 at 12:01:28AM CEST:
> 
> I'm working on putting together my first automake project, 3 executables,
> multiple convenience libraries, among a few folders.
> It includes some third party libraries and header files that are stored
> elsewhere.
> I'd like to have a central variable (thirdPartyPath=/home/blah/third) that
> holds the path to this directory (as well as other include dirs) that can be
> accessed by all Makefile.am's (mine_CPPFLAGS = -I$(thirdPartyPath)) so I
> don't have to define it in every file. At the moment I can't seem to get the
> .am files to share variable definitions. 

You can either
  AC_SUBST([thirdPartyPath], [/home/blah/third])

in configure.ac, or have a common fragment that you
  include fragment.am

in each Makefile.am.

I suggest using the former, and also making the path configurable/
overridable.  Fixed paths are likely going to be wrong on your users'
systems.

> Additionally is there a way that I can have all the PROGRAMS build into one
> common bin directory even though the sources and makefiles reside in
> different folders?

You mean in the build tree or in the install tree?  For the latter,
listing them all in bin_PROGRAMS is sufficient.  For the former, you
could simply go with only one Makefile.am in a non-recursive makefile
setup, or write something like
  bin_PROGRAMS = ../bin/foo

but that will likely cause distcheck problems, at least when you also
use libtool.  I suggest not bothering too much with build tree layout.

Hope that helps.

Cheers,
Ralf




reply via email to

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