The .DELETE_ON_ERROR
target will tell make to delete a target if a rule fails. But this doesn't work for pipelines, because the exit status value $?
holds the value of the last program in the pipeline. As an example, the following makefile will not delete the newly created file foo.
.DELETE_ON_ERROR:
foo:
false | true > foo
Is there a way to get make to consider the rule as having failed if any of the programs in the pipeline fail (i.e., if there's a non-zero value in any of the elements of the $PIPESTATUS
array)?