Linux 2.6 nanosecond time stamp weirdness breaks GCC build

Alexandre Oliva aoliva@redhat.com
Fri Apr 2 17:28:00 GMT 2004


On Apr  1, 2004, Ulrich Weigand <weigand@i1.informatik.uni-erlangen.de> wrote:

> - STAMP = echo timestamp >
> + STAMP = sleep 1 >

I don't think this will fix the problem, at least not portably.

sleep 1 > filename

will truncate filename before sleep starts, modifying its timestamp at
that point, and leave it unchanged afterwards.  Some systems might
update the timestamp again when the file truncated&opened for writing
is closed, but I don't think this is required.  Worse yet: some
systems don't support empty files, and will error out because sleep 1
produced no output.  Also, since some filesystems don't have 1-second
granularity, you should probably use `sleep 2' instead.

A more portable way to spell it would be:

STAMP = sleep 2; echo timestamp >

or, in order to make $(STAMP) usable in the middle of &&/|| sequences:

STAMP = { sleep 2; echo timestamp; } >

-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}



More information about the Gcc mailing list