automake
[Top][All Lists]
Advanced

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

Re: Atomic control of subdirectories with recursive automake


From: Brian
Subject: Re: Atomic control of subdirectories with recursive automake
Date: Wed, 27 Jul 2005 17:15:42 -0600

I wanted to be a little more clear on this (since you brought up the idea of 
subdirectories I have become keen on it)

Suppose I wanted to make two versions of hello - one in /src/hello and one 
in /src/hello/debug. Both programs would use src/hello/main.c as their 
source file. 

Is this possible while using only the makefile.am <http://makefile.am> in 
/src/hello ?

Cheers,
Brian



On 7/27/05, Brian <address@hidden> wrote:
> 
> Thank you for the advice.
> 
> The separate build directories would be nice. How could I ween autotools 
> into doing it automatically?
> 
> Brian
> 
> 
> 
> On 7/25/05, Bob Proulx <address@hidden> wrote:
> > 
> > Brian wrote:
> > > I am in the planning stages of autoconfiscating a large project. The 
> > project
> > > will have a top-level makefile.am <http://makefile.am> 
> > > <http://makefile.am 
> > > and then several
> > 
> > Did you expect that to be a http web link?
> > 
> > > subdirectories which each generate an executeable and have a
> > > makefile.am <http://makefile.am>< http://makefile.am>.
> > 
> > Every directory will have a Makefile.am <http://Makefile.am> file and a 
> > recursive make will
> > be performed. Okay. Sounds fine. That is all normal.
> > 
> > > A specific feature I have been asked for is the ability to jump into 
> > any of 
> > > the given subdirectories and run only that makfile, compiling only 
> > that
> > > program.
> > 
> > That is a normal feature of automake generated Makefiles. Only that
> > directory will be made. However if that directory depends upon 
> > another directory such as a library then that other directory will
> > need to be made first. A top level make will traverse all
> > directories.
> > 
> > But what you are talking about there is just edit, make, edit, make, 
> > in a single directory and that is all standard and works fine.
> > 
> > It is also possible to optionally configure automake to create only a
> > top level Makefile. But that does not sound like what you want. It
> > is optional, so just don't do it. 
> > 
> > > Additionally, at configure time an option such as --enable-debug
> > > should be available, and if set, should create an additional debug 
> > version
> > > of each subdirectory using the same source files (with optionally 
> > different 
> > > flags to custom programs) and leave the intermediate object files
> > > behind.
> > 
> > That can probably be done and someone will suggest a way to do it.
> > But normally if that is what you want then you would use separate 
> > build directories. While in your top level project directory:
> > 
> > mkdir ../project-optimized
> > cd ../project-optimized
> > ../project/configure CFLAGS=-O
> > 
> > mkdir ../project-debug
> > cd ../project-debug 
> > ../project/configure CFLAGS=-g
> > 
> > mkdir ../project-profile
> > cd ../project-profile
> > ../project/configure CFLAGS=-p
> > 
> > This will build three different copies of your project, each with the
> > build flags you gave it. 
> > 
> > > In some sample tests where the only source file was main.c and
> > > bin_PROGRAMS = hello helloDebug, I was left with only one main.o. Of
> > > course I couldn't have two, but there was no "autorenaming" so to 
> > > speak.
> > 
> > By building in separate directories as in the above there is no need
> > to rename because the programs are built in different directories.
> > 
> > > To recap:
> > >
> > > - Optionally make subdirectories individually 
> > 
> > Normal for recursive make configurations.
> > 
> > > - Optionally keep separate intermediate files of simultaneous regular
> > > and debug builds
> > 
> > Build in separate directories.
> > 
> > > - Pass flags from configure all the way to individual debug 
> > > builds (I know how to enable the flags, just now how to make sure
> > > they make it all the way down)
> > 
> > When passed to configure those flags will be configured into all of
> > the Makefiles below. To change flags you configure with different 
> > flags. This is the output of AC_CONFIG_FILES and AC_OUTPUT.
> > 
> > Bob
> > 
> 
>


reply via email to

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