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: Stefano Lattarini
Subject: Re: [RFC] recursion: support user-defined recursive targets
Date: Sat, 30 Jun 2012 10:56:54 +0200

On 06/29/2012 07:46 PM, Stefano Lattarini wrote:
> The user can now define his own recursive targets that recurse
> in the directories specified in $(SUBDIRS).  That can be done by
> specifying the name of such targets in invocations of the new
> 'AM_EXTRA_RECURSIVE_TARGETS' m4 macro.
> 
> The API goes like this:
> 
>     $ 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
> 
>     $ cat Makefile.am
>     SUBDIRS = sub
>     foo-local:
>         @echo This will be run by "make foo".
> 
>     $ cat sub/Makefile.am
>     foo-local:
>         @echo This too will be run by a "make foo" issued either in
>         @echo the 'sub/' directory or in the top-level directory.
> 
> Like for the "default" recursive targets (e.g., 'all' and 'check'),
> the user-defined recursive targets descend in the $(SUBDIRS) in a
> depth-first fashion, and process '.' last (unless that is explicitly
> specified in $(SUBDIRS)).
> 
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.
+
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:
+        @echo This will be run by "make foo".
+% @kbd{cat sub/Makefile.am}
+foo-local:
+        @echo This too will be run by a "make foo" issued either in
+        @echo the 'sub/' directory or in the top-level directory.
address@hidden example
+
 @node Conditional Subdirectories
 @section Conditional Subdirectories
 @cindex Subdirectories, building conditionally




reply via email to

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