Subject: Re: bug in handling of != in make?
To: None <>
From: Roland Illig <>
List: tech-userlevel
Date: 06/09/2006 15:11:40
Alan Barrett wrote:
> != is not mangling the output; "VERSION != cat file" will set
> VERSION=$NetBSD$ as expected.  However, != is also not protecting the
> result from being mangled later.

You're right, I have been a little imprecise here.

> Subsequent expansion of ${VERSION} will recursively try to expand
> $N at the beginning and $<nothing> at the end.  AFAIK, there's no
> way to suppress this recursive expansion.  Using ${VERSION:Q} after
> VERSION!=... doesn't help because the recursive expansion happens before
> the :Q modifier is applied.
> The only way around it, AFAIK, is to apply a :Q modifier after the
> shell expansion but before saving the result into a variable, as in
> ${VERSION_CMD:sh:Q}.

That doesn't help either, because \$NetBSD\$ is still interpreted as 
(backslash, value_of("N"), e, t, B, S, D, backslash, value_of("")).

VERSION_CMD would need a "| sed 's,\$,$$,g'" appended to it to make this 

VERSION_cmd=    echo '$$NetBSD$$' | sed -e 's,\$$,$$$$,g'
VERSION:=       ${VERSION_cmd:sh}

         echo ${VERSION:Q}