On 08/13/2011 11:10 AM, Bruno Haible wrote:
> Why is "make -q" looking for a file 'check-macro-version'
> although the target is declared phony?

I expect that it's because historically, 'make' always identified
rule names with file names, and .PHONY was introduced with
a minimum of change to the historical behavior.

I also tried using a double-colon rule for check-macro-version,
without .PHONY, and that didn't work with 'make -q' either.

> Does it mean phony targets are generally incompatible with "make -q"?

Apparently so, and that's what I would expect given the documentation
that you quoted: a phony target is always considered to be out-of-date,
so make -q FOO should fail if FOO is (or depends on) a phony target.

It might be worth extending GNU Make to add a new special target,
.CHECK say, which would attack this problem.  Any dependency of
.CHECK should be a rule that is executed purely for its exit status
and/or output to stdout or stderr, and all the dependencies of this
rule would have a similar restriction.  'make -q' could invoke
these rules' actions.  The rule names would not be associated with
file names.  (I haven't thought through this proposal carefully; I'm
throwing it out mostly to show the difference between .PHONY and
what's wanted here.)

In the meantime, though, we're stuck with workarounds such as the
one I installed.  In this particular case the workaround is not
so bad.

There may be similar problems elsewhere, in rules that create
time stamp files.  Getting such rules to work for both -j and -q
may be tricky.  I have not gone searching for problems
in that area, though.

Reply via email to