title: Define a Makefile variable using a ENV variable or a default value
body: <p>I am trying to do a simple thing:</p>
  
  <pre><code>TMPDIR ?= /tmp
  
  test:
      @echo $(TMPDIR)
  </code></pre>
  
  <p>This works if I run:</p>
  
  <pre><code>$ make test
  /tmp
  </code></pre>
  
  <p>It also works if I run:</p>
  
  <pre><code>$ make test -e TMPDIR=~/tmp
  /home/user/tmp
  </code></pre>
  
  <p>What can I do to also have it works for:</p>
  
  <pre><code>$ TMPDIR=~/tmp make test
  /home/user/tmp
  </code></pre>