[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Variable Assignment Consistency
From: |
Paul Smith |
Subject: |
Re: Variable Assignment Consistency |
Date: |
Thu, 06 Dec 2012 18:14:08 -0500 |
On Thu, 2012-12-06 at 14:12 -0800, Chris Penev wrote:
> I would expect there to be no difference between the two hashes.
That expectation would not be correct, clearly :-). Make has its own
escaping and expanding procedures that it follows, in addition to /
aside from what the shell does.
> If instead of piping the output of make to md5sum I convert the output
> to hex, I see that ...
>
> In one case (the first one)
> * make converts the newline character to a space.
> In the other case (the second one)
> * make does not convert the newline character to a space
> * make deletes the characters \044 \045
> * leading me to think make tried to expand $% as
> a variable.
You have perfectly captured the differences. They are easily
explainable.
>From the GNU make manual description of the $(shell ...) function:
The `shell' function performs the same function that backquotes
(``') perform in most shells: it does "command expansion". This means
that it takes as an argument a shell command and evaluates to the
output of the command. The only processing `make' does on the result
is to convert each newline (or carriage-return / newline pair) to a
single space. If there is a trailing (carriage-return and) newline it
will simply be removed.
In the second case, you are assigning a value to a variable (that is,
make sees just an assignment like "E=abcedfg$%hijk" or whatever, and
values are always expanded.