title: GNU-make check if element exists in list/array
body: <p>I have a list defined in the make file and the user is supposed to set an environment variable which I need to find in this list. Is there a way using gnu make to do this? I want to do this outside any recipe, before make starts building any targets. It is a QA check to make sure user sets the env. variable to a value within a range/list.</p>
  
  <p>On terminal:</p>
  
  <pre><code>setenv ENV_PARAM x
  </code></pre>
  
  <p>In Makefile:</p>
  
  <pre><code>PARAMS := a b c
  
  if ${ENV_PARAM} exists in $(PARAMS)
    true
  else
    false
  endif
  </code></pre>
  
  <p>@MadScientist's answer works. Is there a way to wrap the if block with a foreach loop to test multiple parameters?</p>
  
  <pre><code>KEYS    := PARAMS FACTORS
  PARAMS  := a b c
  FACTORS := x y z
  
  foreach v in ($(KEYS)) {
    ifneq ($(filter $(ENV_$(v)),$(v)),)
      $(info $(ENV_$(v)) exists in $(v))
    else
      $(info $(ENV_$(v)) does not exist in $(v))
    endif
  }
  </code></pre>