Subject: Re: printing expanded variables?
To: \"Simon J. Gerraty\" <sjg@crufty.net>
From: Mark Valentine <mark@valentine.me.uk>
List: tech-toolchain
Date: 10/04/2003 14:27:11
> From: sjg@crufty.net ("Simon J. Gerraty")
> Date: Tue 2 Sep, 2003
> Subject: printing expanded variables?

> Anyone find it frustrating when make -V FOO shows you just ${FU}?
> Sometimes you want, that, but often you just want to know what it
> expands to.  Changing the behavior of -V would of course break the
> world, so how about -v for the expanded version? (ok I'm lousy at
> naming things ;-)

Sorry to come in here late, but I thought I'd add some perspective.

I'm not sure of the derivation of NetBSD's make -V, but I came up with
it a few years back for FreeBSD's make as a debugging tool: the primary
reason it's there is to show how the variable was assigned within a
build system of nested makefiles.  If I wanted to see the final value
of the variable I just added a target to the makefile which echo'd it!

So, the value of showing the final value of the variable is to me merely
a convenience.

However, some wise soul in the FreeBSD project later thought it would be more
useful to show the final value, and I didn't notice this change for several
releases (I guess my build system was stable at that point!).

As a result, I had to submit a new option -X to get back the behaviour I
needed.

If NetBSD's -V wasn't an independent addition, then presumably it was picked
up from FreeBSD in the time between original implementation and the time it
was "broken" for good.  (Actually last time I tried it in FreeBSD it seemed
to be broken completely.)

So now of course we have two make(1) implementations with a similar but
critically different -V option and a needless conflict with -X...

However, the new NetBSD behaviour seems reasonable to me (though I would have
elected for a simpler option than parsing the -V option argument myself - I
haven't looked to see what "make -V 'FOO$BAR'" does, for example), since make
-V usefully does something you can't do in a makefile for the simple case and
yet offers a convenient way of avoiding editing the makefile for a simple
common debugging task.

		Cheers,

		Mark.

-- 
"Tigers will do ANYTHING for a tuna fish sandwich."
"We're kind of stupid that way."   *munch* *munch*
  -- <http://www.calvinandhobbes.com>