title: Share variables between makefiles
body: <p>I have a directory structure where I want one main makefile in my main folder, and then another makefile in both my test and src folder.</p>
  
  <p>In my main makefile, I have directives for both test / all that call the individual folder makefiles. I'm trying to declare variables in my main makefile and have them accessible to those other folders.</p>
  
  <p>For instance in my main Makefile</p>
  
  <pre><code>PACKAGES = jansson mysql ....
  
  all:
      do something here
  
  test:
  
      cd test
      make test
  </code></pre>
  
  <p>And then in my test/Makefile I want to be able to access the previous PACKAGES variable and add this makefile's individual dependencies onto it.</p>
  
  <p>In the test/Makefile</p>
  
  <pre><code>PACKAGES += googletest googlemock
  
  test
       do something here
  </code></pre>
  
  <p>Could anyone help me solve this problem?</p>