bug-make
[Top][All Lists]
Advanced

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

Re: Variable Assignment Consistency


From: Chris Penev
Subject: Re: Variable Assignment Consistency
Date: Thu, 6 Dec 2012 14:55:19 -0800

I just found my own answer by reading the relevant part of the gnu make manual

http://www.gnu.org/software/make/manual/html_node/Shell-Function.html

Sorry for the bother. It seems like make is doing what is documented.

On Thu, Dec 6, 2012 at 2:12 PM, Chris Penev <address@hidden> wrote:
Dear gnu-make gurus,

I have the following c program (garble.c)

#include <unistd.h>

int main() {

        unsigned char buf[256];
        int           off;

        for(off = 0; off < sizeof buf; off++)
                buf[off] = off;

        return write(1, buf, sizeof buf) != off;
}


and the following makefile (makefile)

E    ?= $(shell ./garble | tr -d \\000)
$(error $(E))


Running the following commands, give me result which seem inconsistent to me.

$ make 2>&1 | md5sum
6bfaed01fc4f24828ce7014b81c4edf1  -

$ make E="$(./garble | tr -d \\000)" 2>&1 | md5sum
59d743d40047b58aa7829fd38870f288  -

I would expect there to be no difference between the two hashes. My environment is

$ sed q /etc/issue; uname -r; make --version
Debian GNU/Linux wheezy/sid \n \l
3.2.0-4-amd64
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu



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.


reply via email to

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