title: Setting environment variables in a makefile
body: <p>I have a makefile like this:</p>
  
  <pre><code>setup:
    setenv var1 "$(var1)"; \
    setenv var2 "$(var2)";
  
  task1: setup
    source task1.csh
  
  task2: setup
    source task2.csh
  </code></pre>
  
  <p>I call the makefile using this command:</p>
  
  <pre><code>make var1=value1 var2=value2 task1
  </code></pre>
  
  <p>I would like environment variables <code>var1</code> and <code>var2</code> to be visible in <code>task1.csh</code> and <code>task2.csh</code>, but I haven't been able to do so unless I change the makefile to:</p>
  
  <pre><code>task1:
    setenv var1 "$(var1)"; \
    setenv var2 "$(var2)"; \
    source task1.csh
  
  task2:
    setenv var1 "$(var1)"; \
    setenv var2 "$(var2)"; \
    source task2.csh
  </code></pre>
  
  <p>Why the first method doesn't work and how can I fix it?</p>