title: Exiting on first error in recursive make
body: <p>Submakes are being brought in by an include statement rather than a for loop like other SO answers for how to do this</p>
  
  <pre><code>  root makefile
    1 all: build
    2
    3 GIT_ROOT ?= $(shell git rev-parse --show-toplevel)
    4
    8
    9 # These get piggybacked onto by the sub-Makefiles
   10 BUILD_DEPS =
   11 CLEAN_DEPS =
   12 PACKAGE_DEPS =
   13 TEST_DEPS =
   14
   15 define validate_in_path
   16 @which $(1) &gt;/dev/null || (echo "Expected to find '$(1)' in PATH" &amp;&amp; exit 1)
   17 endef
   18
   19 include $(GIT_ROOT)/*/Makefile.sub
   20
   21 .PHONY: all build clean package
   22
   23 build: $(BUILD_DEPS)
  </code></pre>
  
  <p>Most of the submakes look something like this where all they do is call a function upstream and pass in parameters for what path that function uses.</p>
  
  <p>What exactly am I supposed to do here to have the entire make process end, meaning all other recursively started makes as well, if line 5 in one this sub-make were to fail.</p>
  
  <p>What I really don't want to do is put in shell logic here to do a PID kill the top level process if something exits with a non-zero code.</p>
  
  <pre><code>  sub makefile
    1 $(eval $(call declare_node_service,autoscaler))
    2 .PHONY += autoscaler clean-autoscaler package-autoscaler
    3
    4 autoscaler: node-lib
    5         $(call build_node,autoscaler)
    6
    7 clean-autoscaler:
    8         $(call clean_node,autoscaler)
    9
   10 package-autoscaler: autoscaler
   11         $(call package_node,autoscaler)
   12
   13 test-autoscaler: autoscaler
   14         $(call test_node,autoscaler)
  </code></pre>