I have the following makefile structure
$ cat makefile
$(MAKE) -C bar barbaz
$ cat bar/makefile
$ make foo
make -C bar barbaz
make: Entering directory `bar'
make: *** [barbaz] Error 111
make: Leaving directory `bar'
make: *** [foo] Error 2
This is not an issue with recursive
make invocation; that is a red herring.
If you simply do this from the shell:
$ make barbaz # in bar directory exit 111 make: *** [barbaz] Error 111 $ echo $? 2
Make isn't propagating the exact exit status of the failing recipe.
This is documented here:
"The exit status of make is always one of three values: [...]'