I wonder if it would be good to have a built-in like $(shell ...) that dies
if the given command exits with non-zero exit code.
Currently I have this somewhat icky fctn:
# This function works almost exactly like the builtin shell command, except it
# stops everything with an error if the shell command given as its argument
# returns non-zero when executed. The other difference is that the output
# is passed through the strip make function (the shell function strips
# only the last trailing newline). In practice this doesn't matter much
# since the output is usually collapsed by the surroundeing make context
# to the same result produced by strip. WARNING: don't try to nest calls
# to this function.
SHELL_CHECKED = \
$(strip \
$(if $(shell (($1) 1>/tmp/SC_so) || echo 'non-empty'), \
$(error shell command '$1' failed. Its stderr should be above \
somewhere. Its stdout is available for review in '/tmp/SC_so'), \
$(shell cat /tmp/SC_so)))
_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make