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: Stepan Kasal
Subject: Re: Atomic control of subdirectories with recursive automake
Date: Mon, 25 Jul 2005 15:18:09 +0200
User-agent: Mutt/1.4.1i

Hello,

On Sun, Jul 24, 2005 at 05:11:57PM -0600, Brian wrote:
> source file was main.c and bin_PROGRAMS = hello helloDebug

set also
        helloDebug_CPPFLAGS = -DDEBUG
and/or
        helloDebug_CFLAGS = -g

in the Makefile.

> [...] but there was no "autorenaming" so to speak.

These so called "per-target options" enable "autorenaming"; you'll have
hello-main.o and helloDebug-main.o.

> 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

in configure.ac, use
        AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = xyes])

and in the appropriate Makefile.am:

        bin_PROGRAMS = hello
        if ENABLE_DEBUG
          bin_PROGRAMS += helloDebug
        endif

No need to make the per-target option assignments optional, if you don't
mind that the renaming will happen every time.

>    - Optionally make subdirectories individually 

This is a standard feature; targets "all" and similar work in each Makefile.

>     - 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)

That's the basic function of Autotools: AC_SUBST([VARIABLE],...)
and then you have $(VARIABLE) in your Makefile.am.
But, actually, you don't need this here, the one bit carried by the conditional
is enough, the flags are in the Makefile.am.

HTH,
        Stepan Kasal




reply via email to

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