title: How to check if a variable is equal to one of two values using the if/or/and functions
body: <p>In a GNU makefile, I would like to set an output variable to one value (let's say "true") if an input variable is equal to one of two values and to another value ("false") when it is not.</p>
  
  <p>Thanks to <a href="https://stackoverflow.com/questions/5584872/complex-conditions-check-in-makefile/5586785#5586785">this SO answer</a> I've learned about the <code>and</code> and the <code>or</code> functions and soon after that I have found the <code>if</code> function. These functions seem to be available in my version of make, so I would like to use them. I would like to write something like that:</p>
  
  <pre><code>TEST_INPUT = `hostname`
  TEST_OUTPUT = $(if $(or $(eq $(TEST_INPUT),hal9000),
                          $(eq $(TEST_INPUT),pipboy)),true,false)
  </code></pre>
  
  <p>Unfortunately I can't, because I couldn't find any obvious form of the expected <code>eq</code> function. I am able to achieve what I want using the <code>filter</code> function:</p>
  
  <pre><code>TRUE_HOSTS = hal9000 pipboy
  TEST_OUTPUT = $(if $(filter $(TEST_INPUT),$(TRUE_HOSTS)),true,false)
  </code></pre>
  
  <p>or the <code>subst</code> function:</p>
  
  <pre><code>TEST_OUTPUT = $(if $(and $(subst hal9000,,$(TEST_INPUT)),
                           $(subst pipboy,,$(TEST_INPUT))),
                     false,true)
  </code></pre>
  
  <p>but for me it isn't a nice looking nor readable code. Are there solutions closer to the first example (the one using not existing <code>eq</code> function)? Maybe I don't catch the purpose of the <code>if</code>, <code>and</code> and <code>or</code> functions at all?</p>