[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Non-recursive automake and double-colon rules
From: |
Nick Bowler |
Subject: |
Re: Non-recursive automake and double-colon rules |
Date: |
Mon, 25 Mar 2013 09:53:39 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On 2013-03-24 11:33 +0000, Roger Leigh wrote:
> If you switch to non-recursive make (i.e. no use of SUBDIRS),
> but you want to use "include" to retain Makefile.ams in
> subdirectories, you end up running into problems when you
> have multiple copies of -local and -hook rules.
[...]
> I've used GNU make double-colon rules to allow the same target to be
> used multiple times. While this is GNU make-specific, it's a simple
> and effective way to convert an existing recursive automake setup to
> being nonrecursive. Possibly worth putting in the documentation (along
> with a portability caveat?)
>
> I'd be interested to know what other people's experiences have been
> here. While I could move everything into the top-level Makefile.am,
> keeping rules together with the files they operate on does have some
> advantages.
The way I normally handle this is to not add commands directly to the
-hook or -local rules, but instead to create new rules with commands and
list them as prerequisites to the appropriate -hook or -local rules.
This does not depend on GNU make. For example:
all-local: extra-stuff
extra-stuff:
echo "hello"
Looking at the GNU make manual, it looks like double-colon rules have an
ordering to them; the above approach does not (and, in fact, allows
the different rules to be run in parallel). So it may also be necessary
to add prerequisites between the individual rules-with-commands as well.
Cheers,
--
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)