title: Makefile Substituting for loop variables to functions
body: <p>I'm not sure what the best way to do this, and some pointers in this regard would be helpful</p>
  
  <h2>Code:</h2>
  
  <pre><code>#Else where in different file and included in this makefile i have
  LIBRARY_LIST    := CONFIG_MTS_PTHREADS
  CONFIG_MTS_PTHREADS :=  y
  
      collect-compilation:
          if  [   $(strip $(CONFIG_MTS_PTHREADS)) ==  y   ]; then \
              echo "ok";  \
          fi;
          for compile in $(LIBRARY_LIST)  ;   do  \
              if  [   $(strip $$compile)  ==  y   ]; then \
                  echo "ok";  \
              fi; \
          done
  </code></pre>
  
  <p>So from the above code snippet., the top part the 'IF' loop works fine as expected and i see 'OK'.
  displayed.</p>
  
  <p>Now for the second for-loop, i have some problems substituting the $$compile to the 'IF'. Eventually i expect $$compile gets replaced by CONFIG_MTS_PTHREADS and the expression should evaluate to y == y and display 'OK' but for me.,</p>
  
  <h2>Output:</h2>
  
  <pre><code>make -C ./Dev2.0.1/OSX
  if  [   y   ==  y   ]; then \
          echo "ok";  \
      fi;
  ok    &lt;----- fine and expected
  for compile in CONFIG_MTS_PTHREADS  ;   do  \
          if  [   $compile    ==  y   ]; then \
              echo "ok";  \
          fi; \
      done      &lt;------ Here it skips the then part and proceeds further, i expect 'OK' after this though.
  </code></pre>