News for hackers. Stuff that matters.
Re:Making CSS saner (from Patrick of Auctomatic) by ralph on Tuesday May 29, 2007 @08:09AM (#25192)
The makefile rule will leave behind a .css file even if there's errors. Compare to "cc -c foo.c" and the existance of foo.o on an error; we don't do "cc -c foo.c >foo.o".

Things like this can cause hard to find problems further down the line in a big system build; after the error the target file exists and is newer than the sources.

Either don't use shell re-direction or do "cmd foo foo.tmp && mv foo.tmp foo".

Re:Making CSS saner (from Patrick of Auctomatic) by omouse on Tuesday May 29, 2007 @09:05AM (#25198)
Or if they can modify the script so if there's an error a return code of nonzero is returned which can be checked by the makefile.
Re:Making CSS saner (from Patrick of Auctomatic) by ralph on Tuesday May 29, 2007 @09:41AM (#25205)
Don't know why anyone's modded you down. I was thinking that either the interpreter, e.g. ruby, or the script itself already returned a non-zero exit status and the makefile detected that. That doesn't cause make to remove the target.

$ make foo

false >foo

make: *** [foo] Error 1

$ make foo

make: `foo' is up to date.

$

I suppose they could do "cmd foo >bar || rm bar" instead of the mv I suggested. But that causes no bar to exist whereas the mv leaves the pre-build one behind.

Re:Making CSS saner (from Patrick of Auctomatic) by pc on Tuesday May 29, 2007 @09:53AM (#25211)
This has never arisen so far (the code is so trivial that errors are rare), but it's a good point, so I just updated the post.
Re:Making CSS saner (from Patrick of Auctomatic) by ralph on Tuesday May 29, 2007 @10:48AM (#25222)
I suppose you could also make $(SOURCES) depend on $(GEN) to save having to remember the "make clean" sometimes. Speaking of clean, the ....out needs cleaning up too, e.g. "rm -f $(SOURCES:%=%.out)" perhaps (untested).