automake-patches
[Top][All Lists]
Advanced

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

Re: [RFC] recursion: support user-defined recursive targets


From: Dave Hart
Subject: Re: [RFC] recursion: support user-defined recursive targets
Date: Sat, 30 Jun 2012 10:54:24 +0000

On Sat, Jun 30, 2012 at 08:56 UTC, Stefano Lattarini wrote:
> And here is the documentation, basically adapted from the commit message.
>
> Comments welcome.
>
> Regards,
>  Stefano
>
> -*-*-*-
>
> diff --git a/doc/automake.texi b/doc/automake.texi
> index 87776b3..2bddc15 100644
> --- a/doc/automake.texi
> +++ b/doc/automake.texi
> @@ -4204,6 +4204,32 @@ will be built.  It is customary to arrange test 
> directories to be
>  built after everything else since they are meant to test what has
>  been constructed.
>
> +In addition to the built-in recursive targets defined by Automake
> +(@code{all}, @code{check}, etc.), the developer can also define his
> +own recursive targets.  That is done by specifying the name of such
> +targets as arguments to the Automake-provided autoconf macro
> address@hidden  Automake will then generate
> +stub rules to automatically handle recursion for such targets; the
> +developer can define real actions for them defining a corresponding
> address@hidden target.

The last sentence is written a bit too much from the Automake
implementor's perspective rather than the Automake user.  I struggled
to come up with something better, but may have failed.

Automake generates rules to handle the recursion for such targets; the
developer defines corresponding @code{-local} targets in Makefile.am
for each directory participating in satisfying the recursive target.

> +
> address@hidden
> +% @kbd{cat configure.ac}
> +AC_INIT([pkg-name], [1.0]
> +AM_INIT_AUTOMAKE
> +AM_EXTRA_RECURSIVE_TARGETS([foo])
> +AC_CONFIG_FILES([Makefile sub/Makefile])
> +AC_OUTPUT
> +% @kbd{cat Makefile.am}
> +SUBDIRS = sub
> +foo-local:
> +       address@hidden This will be run by "make foo".
> +% @kbd{cat sub/Makefile.am}
> +foo-local:
> +       address@hidden This too will be run by a "make foo" issued either in
> +       address@hidden the 'sub/' directory or in the top-level directory.
> address@hidden example
> +
> address@hidden Conditional Subdirectories
> address@hidden Conditional Subdirectories
> address@hidden Subdirectories, building conditionally

The example looks good, and I want to thank you for introducing this
obvious way to factor out duplicative hand-rolled make subdir
recursion in projects that need it, particularly in light of
"Recursive Make Considered Harmful", which might have caused a lesser
man to believe this patch is counterproductive by catering to sadly
outdated troglodytes.

Cheers,
Dave Hart



reply via email to

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