Hi, This is my first posting to the GNU Make mailing lists, so please let me know if i've contravened any expectations.
## Background I am a somewhat heavy user of GNU Make, and frequently want to do something like the following: FILE_SHA = $(shell sha256sum src/file.c) deploy-frobnicate: rsync src/file.c remote:dist/file-${FILE_SHA}.c Obviously this is a toy example, but bear with me. In almost all of my own use-cases it makes no sense to continue execution if the command passed to $(shell ...) exits nonzero. In fact, it is often destructive, because empty strings being used in subsequent commands frequently risk doing the wrong thing for my situation. I'm aware that there are workarounds such as the pattern of testing .SHELLSTATUS after having invoked $(shell), but i find this extremely cumbersome. For example, this can work, FOO := $(shell exit 12) ifneq ($(.SHELLSTATUS),0) $(error Shell failed with $(.SHELLSTATUS)) endif However, that only works if i am disciplined and never use lazy assignment -- for slow commands that's not a good trade-off. There's also the approach of setting .ONESHELL, but i'm not sure i'd like to rewrite all my Makefiles such that that's feasible. Also, as far as i understand, that won't help me when i'm wanting to set a "top-level" variable to the stdout of a shell command, which is what i'm most often doing. ## Finally getting to the point I'm writing to ask whether there's any chance that a patch might be accepted if i add a configurable setting (for example, similar to .ONESHELL, maybe an option called .SHELL_ERREXIT, to match Bash's `-o errexit` option) which will cause any $(shell ...) invocation exiting nonzero to halt Make with an error message. Of course such a flag would have to default to Make's current behaviour of entirely ignoring exit codes. I haven't looked at the code extremely thoroughly, but it looks like i'd have to modify func_shell_base in function.c, as well as do whatever needs to be done to introduce, document, and handle an option flag such as i've described. I'd be happy to have a stab at it, but i wouldn't want to start working on a patchset if there's zero chance the maintainers would be interested in the feature. Hope that all makes sense, kind regards, happy holidays, paul