%% "Albert L. Ting" <[EMAIL PROTECTED]> writes:

  alt> Doing a "make -q" with the following makefile returns a 1 status
  alt> where it should really return a 0 status.  Can this be fixed?  I
  alt> know I could wrap an ifndef expression around the ALL commands,
  alt> but I use this a lot.

  alt>  commands :=

  alt>  .PHONY: all

  alt>  all: foo
  alt>          $(commands)

  alt>  foo: bar
  alt>          touch foo

I think I see what you mean; you have a foo and a bar and those don't
need to be built, but because the "all" rule has commands it will always
get run, and -q will always return 1.

What you're saying is since $(commands) is really empty, there aren't
any commands to run and make should return 0 here.

Hmm.  The problem is that make _does_ make an important distinction
between:

  all: foo

which is just a target/dependency declaration, and

  all: foo ;

which is a complete rule.  Although the command list is empty, and make
does have special processing to avoid invoking a do-nothing shell in
this case, they are not equivalent.

Hmm hmm.  If the change you want were made, it would mean that -q would
always return a 0 status for any rule with an empty command script.  Hmm
hmm hmm.  Offhand I can't think of any reason why that would hurt
anything, except it is a sort of unusual special case, in some ways;
documenting it might be painful.

Also, unfortunately right now there are about 4 different places during
the invocation of a rule's command set where we check for an empty
command string; it would be kind of gross to add an extra check in each
of those places for the -q option.  I've long felt that there is
excessive processing going on there, but I haven't delved into the guts
to determine which checks might be superfluous.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

Reply via email to