title: How to exclude a particular file with GNUMake's wildcard function?
body: <p>My project's directory structure is as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/4OSmP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4OSmP.png" alt="enter image description here"></a></p>
  
  <p>My Makefile looks like this:</p>
  
  <pre><code>dir1_contents := $(wildcard dir1/*) 
  dir3_contents := $(wildcard dir3/*)
  
  all: clean_dir1 clean_dir3
  
  clean_dir1:
      echo 'dir1_contents = $(dir1_contents)'
  
  clean_dir3:
  echo 'dir3_contents = $(dir3_contents)'
  </code></pre>
  
  <p>When I run make, this is what I get:</p>
  
  <pre><code>$ pwd
  make-test
  
  $ make -s
  dir1_contents = dir1/dir2 dir1/file2.junk dir1/file3.junk
  dir3_contents = dir3/file4.junk
  </code></pre>
  
  <p>I want to get the contents of <code>dir1</code> in <code>dir1_contents</code>. But I want to exclude <code>file3.junk</code> from that list. How can I do it? </p>
  
  <p>Perhaps I should use <code>grep -v</code>? But I'm not sure that's the best way. Is there a built-in GNUMake function I can use here?</p>