title: how to check if a directory does "not exist" in Makefile? if [ ! -d ... ] returns always true
body: <p>I want to add a couple of lines so that the make process can error out if certain directory (set by a Makefile variable DIR1) doesn't exist. Here is the added part but this errors out even if I the directory set by DIR1 exists. For example, I made the directory called 'dir1' but make errors out. What is wrong?</p>
  <pre><code>DIR1 = dir1
  
  .PHONY : check_dir
  
  $(info DIR1 = $(DIR1))
  
  check_dir:  
      if [ ! -d $(DIR1) ]; then \
          $(error &quot;DIR1 does not exist! check Makefile!&quot;); \
      fi
  </code></pre>
  <p>This is the run result.(I have directory called <code>dir1</code> in current directory).</p>
  <pre><code>&gt; ckim@chan-ubuntu:~/testmake/test1$ make  
  &gt; DIR1 = dir1 Makefile:8:
  &gt; *** &quot;DIR1 does not exist! check Makefile!&quot;.  Stop.
  </code></pre>