bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: gmake doesn't produce err mesg when it should


From: Paul D. Smith
Subject: Re: gmake doesn't produce err mesg when it should
Date: 01 Nov 2000 15:22:05 -0500
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7

%% address@hidden (Gabriel Zachmann) writes:

  gz> Why doesn't gmake produce an error message when I write a $(call
  gz> blub,...) of a "function" blub which doesn't exist?

  gz> And why doesn't gmake produce an error message
  gz> when I write $(wildacrd ...) which is a function which doesn't exist?

Well, --warn-undefined-variables will warn you of both those
conditions.

However, this is annoying as most makefiles have lots of valid reasons
to reference undefined variables.

If you want to use this regularly you'll need to set all the
variables you use but which may legitimately be empty to empty up-front,
so they are no longer undefined.

If you tend to make these kinds of typos often, though, that effort
might be well worth it.

  gz> Note that it would be possible for gmake to detect these errors:
  gz> an expression $(something ..), where 'something' is followed by a space,
  gz> cannot be a make variable.

Correct.

  gz> In the case of $(call blub,...) when 'blub' doesn't exist (yet),
  gz> it would be nice to have the option of having make produce a warning.
  gz> In the case of "built-in" functions like $(wildacrd ...),
  gz> it is always an error, I think.

I'm considering adding some syntactic sugar to a future version of make
which allows a syntax $(xxxx ...) (with a space) to be automatically
treated as $(call xxxx,...) if xxxx isn't a builtin.  This would reduce
the second case to the first.

However, I think a new option like "--warn-undefined-functions" would be
quite reasonable.

Actually, I want to generalize the --warn option the same way I
generalized the --debug option, and plan to generalize the verbosity
output of make, to avoid an explosion of new command-line options.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          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

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