title: makefile: fail on single make target if variable empty
body: <p>I'm new to building Makefiles and am trying to determine how fail a build target if a variable is empty. I want to be able to pass in the variable as an environment variable or as a make parameter.</p>
  
  <p>Say I have a makefile like this:</p>
  
  <pre><code>VER ?=
  
  step0:
      echo "step0 should work"
  
  step1: 
      echo "step1 should enforce variable"
      ifeq($(VER), "")
      $(error VER is not set)
      endif 
      echo "Success: Value of Ver ${VER}"
  
  step2:
      echo "step2 should work"
  </code></pre>
  
  <p>I want to be able to run the following test cases:</p>
  
  <pre><code>VER="foo" make step1  
  # should result in printing the "Success:" line
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>export VER=foo
  make step1  
  # should result in printing the "Success:" line
  </code></pre>
  
  <p>OR </p>
  
  <pre><code>make step1 VER=foo  
  # should result in printing the "Success:" line
  </code></pre>
  
  <p>OR </p>
  
  <pre><code>make step1  
  # should result in printing "VER is not set"
  </code></pre>
  
  <p>However, when I run <code>make step</code> using any of the above, I always get the <code>VER is not set</code> error. </p>
  
  <p>Simply put, how can I test for a variable in a specific make target and respond with an error message if it's not set? (but other make targets would not care if the variable is set or not)</p>