help-make
[Top][All Lists]
Advanced

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

Re: $x //Re: $(value) of function parameters


From: Paul D. Smith
Subject: Re: $x //Re: $(value) of function parameters
Date: Thu, 10 Jun 2004 01:06:34 -0400

%% "Markus Mauhart" <address@hidden> writes:

  mm> a := a$}z
  mm> $(warning [value of a] = [$(value a)])
  mm> a := a$)z
  mm> $(warning [value of a] = [$(value a)])
  mm> a := a$}z
  mm> ${warning [value of a] = [${value a}]}
  mm> a := a$)z
  mm> ${warning [value of a] = [${value a}]}

  mm> ... it results in ...

  mm> makefile1.txt:16: [value of a] = [az]
  mm> makefile1.txt:18: [value of a] = [a)z]
  mm> makefile1.txt:20: [value of a] = [az]
  mm> makefile1.txt:22: [value of a] = [a)z]

  mm> IMHO 2 of the 4 lines show bugs, either 16&20 or 18&22; correct ?

Hah!!

You're right, this is a bug; it's been in make since... well, a very
long time: since the very first version we have access to, committed in
September of 1991.  Lines 18 & 22 are wrong, and I know exactly why.
This will be fixed in the next release.

  mm> webstore.ansi.org sells two "1003.2-1992" papers for each ~100$.
  mm> www.unix-systems.org has susv2 = UNIX98 specs for download, this
  mm> AFAICS claims POSIX.2 compatibility for its make utility. Its
  mm> susv2/xcu/make.html is rather short compared with GNUmake's
  mm> manual.

Indeed... GNU make (in fact, just about every make that exists today)
contains a good deal of enhancements in addition to what's defined by
POSIX.  However, any makefile written to the POSIX spec will run
properly in GNU make.

I do have a hardcopy of the original POSIX spec, but these days I tend
to use the online Open Group Base Specifications Issue 6 (1003.1 2004
Edition), from www.opengroup.org.

  mm> On 1st view I'd say that UNIX98' make, during expansion of
  mm> $(String), never expects any "$" inside String; also GNUmake's
  mm> manual saying that "computed variable references" are its own
  mm> invention is a hint in that direction.  So I hope you understand
  mm> that I doubt a bit that POSIX.2-make's treatment of "$)" and "$}"
  mm> and "$," has much to do with GNUmake's theory and practice.

That may be true if they appear inside a variable reference, but the
behavior of these variables outside of any variable reference is
well-defined.  Since GNU make _DOES_ support "computed variable
references" it would be far too odd to have them behave differently
there.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "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]