title: Passing variables from include directive to sub-make
body: <p>Looking for some help passing variables from one level to the next in a makefile.  I have a source tree that needs to be built to run on various target architectures.  To keep the higher level makefile clean I created separate makefiles that contain architecture specific information and include only the one that is required using the include directive :) </p>
  
  <p>Later in the makefile I transfer to another directory to build the source files.  The build fails and I see that the failure is caused by the architecture-specific variables not being passed.</p>
  
  <pre><code>ifeq ($(ARCH), my_arch)        |
  include build/my_archdefs.mk   |  section 1 
  endif                          |
  
  &lt;more commands&gt;
  debug:
        $(MAKE) -C src debug
  </code></pre>
  
  <p>The makefile to build the code tree is in the src directory. As a stop gap measure I included section 1 referenced above in the lower level makefile and in this case I noticed that the variable ARCH was not being passed down.</p>
  
  <p>Here are a couple of links I found that seemed related but I'm not able to figure out what I need to do make this work.
  <a href="http://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html#Options_002fRecursion">http://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html#Options_002fRecursion</a>
  <a href="http://www.gnu.org/software/make/manual/html_node/Include.html">http://www.gnu.org/software/make/manual/html_node/Include.html</a></p>
  
  <p>It seems to me that the info I need is lurking in the links I referenced above but I'm just not seeing it.  Any pointers will be much appreciated.</p>
  
  <p>Thanks.</p>