title: Makefile test if variable is not empty
body: <p>In a makefile I'm trying to</p>
  
  <ul>
  <li>run a shell command and capture the output in a make variable</li>
  <li>do something if the variable is not empty</li>
  </ul>
  
  <p>I've created this simplified makefile to demonstrate my problem. Neither <code>make a</code> or <code>make b</code> executes the body of the if, I don't understand why not.</p>
  
  <pre><code>.PHONY: a b
  
  a:
      $(eval MY_VAR = $(shell echo whatever))
      @echo MY_VAR is $(MY_VAR)
      $(info $(MY_VAR))
  ifneq ($(strip $(MY_VAR)),)
      @echo "should be executed"
  endif
      @echo done
  
  b:
      $(eval MY_VAR = $(shell echo ''))
      @echo MY_VAR is $(MY_VAR)
      $(info $(MY_VAR))
  ifneq ($(strip $(MY_VAR)),)
      @echo "should not be executed"
  endif
      @echo done
  </code></pre>
  
  <p>I'm using</p>
  
  <pre><code>$ make --version
  GNU Make 3.81
  </code></pre>
  
  <p>Edit: as pointed out, the vars don't need to be make vars</p>