On 2/08/2010 18:08, Erik Rull wrote:
I would propose:
php -l | grep "No syntax errors" -v
This returns you everything on stdout except those lines that contain
"No syntax errors"
Filtering done using a shell call should be faster than a parsing and
filtering done by make. (Please correct me if this does not apply!!)
I can see this go wrong, if you're simply using that as recipe in a
rule. If the php command fails, you'll see the "Errors parsing ..." as
expected, but what's the exit code in this case? Hint: the grep in the
pipe won't find matches, and the -v option is used. This in turn makes
GNU make think that the command succeeded, and it'll carry on, which is
usually not what you want.
There are most likely solutions/workarounds for this (the use of
PIPESTATUS in bash comes to mind), but getting this right might be
tricky, depending on the environment you're working in...
At first sight, I'd say the most straightforward way to fix the original
problem is using a small wrapper script and temporary files. Execute the
php command saving its output, check its exit code and act accordingly.
Danny
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make