[Top][All Lists]

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

suggestion for manual

From: Eric Hanchrow
Subject: suggestion for manual
Date: Tue, 16 Oct 2001 13:18:38 -0700

(I'm reading the manual for version 3.79)

At the end of Node: Multiple Rules, I think it'd be useful to have a
reference to Node: Double-Colon, since double-colon rules are another way to
have multiple rules all with the same target.

Here's how I came across this:

I have a hierarchy of projects with a top-level makefile.  A very few of the
lower-level Makefiles have targets named `check', which (as you'd expect)
run some self-tests.  I wanted to be able to type `make check' at the top of
the hierarchy, and have all of the self-tests run, in the projects that
*had* self tests, and in the other projects, I wanted nothing to happen.

I first tried simply having the top-level `check' target invoke make
recursively on its children.  But that caused errors ("no rule to make
target check") in the projects that had no `check' target.

I then read Node: Overriding Makefiles, and was considering implementing its
suggestion, when somebody suggested that I use double-colon rules instead.
Double-colon rules seemed like a cleaner way to do what I wanted, so I'm now
using them.  (The top-level makefile has a double-colon rule with the target
`check', with no prerequisistes and no commands; the few lower-level
makefiles that have self-tests each have their own double-colon rule with
the target `check', but whose prerequisites are the binary that gets made in
that directory, and whose command invokes the self-tests; the lower-level
makefiles in projects that lack self-tests simply have no rule at all for

However, I wish the manual had suggested them in Node: Multiple Rules; had
it done so, I would have saved some time.


reply via email to

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