title: Makefile - make finds a file whilst shell does not
body: <p>I've written a snippet of Makefile that checks if file exists before executing <strong>rm</strong> upon it.</p>
  <pre><code>clean:
  echo &quot;Attempt to remove $(exec) file&quot;
  if test -f &quot;${exec}&quot; ; then \
  echo &quot;Removing file ${exec}&quot; ; \
  rm ${exec} ; \
  else \
  echo &quot;No ${exec} file to remove&quot; ; \
  fi
  
  if &quot;$(wildcard *.o)&quot; = &quot;&quot; ; then \
  echo &quot;No files found&quot; ; \
  else \
  echo &quot; Found $(wildcard *.o) &quot; ; \
  fi
  </code></pre>
  <p>First <strong>if</strong> statement works fine<br />
  <em>Attempt to remove hello file<br />
  No hello file to remove</em></p>
  <p>while the second produces this:</p>
  <p><em>/bin/sh: 1: main.o factorial.o: not found<br />
  Found main.o factorial.o</em></p>
  <p>My question is: How come that <strong>make recipe</strong> produces valid output ( these files truly exist ) whilst the <strong>shell</strong> does not? And why <strong>shell</strong> even tries to find them?</p>
  <p>Thank you for your time reading this question. That's my first one here so if I did something inappropriately please let me know</p>