title: How stop GNU make from interfering with filenames that contain dollar-signs?
body: <p>So I am compiling java code, which often creates .class files where there is a dollar-sign in the filename.  GNU make seems to hate this and keeps interfering with the filenames.</p>
  
  <p>As a simple (contrived) example, suppose I want to create a GNU Makefile task that will do a hexdump on all the .class files in the MyFolder directory (and it's subfolders).</p>
  
  <p>Now suppose MyFolder has the following files:</p>
  
  <blockquote>
  <pre><code>MyFolder/makefile
  MyFolder/sample.java
  MyFolder/subdir/abc$1.class
  MyFolder/subdir/test.java
  MyFolder/xyz.class
  </code></pre>
  </blockquote>
  
  <p>The goal is to write a recipe that runs hexdump, passing it all the .class files in MyFolder (and its subfolders).  So for the above list of files the final command that GNU make should execute, would be:</p>
  
  <blockquote>
  <pre><code>hexdump subdir/abc$1.class xyz.class
  </code></pre>
  </blockquote>
  
  <p>This should be so easy as falling off a log, but GNU make seems to have gone to extreme pains to make this as difficult as possible.  The naive attempt with the following Makefile does not work:</p>
  
  <blockquote>
  <pre><code>default:
      hexdump $(shell find -name '*.class')
  </code></pre>
  </blockquote>
  
  <p>If you run this Makefile, you get the following error:</p>
  
  <blockquote>
  <pre><code>hexdump ./subdir/abc$1.class ./xyz.class
  hexdump: ./subdir/abc.class: No such file or directory
  make: *** [makefile:3: default] Error 1
  </code></pre>
  </blockquote>
  
  <p>Notice how in the first line of the above output, the command is correct (the filenames contain the dollar-sign character).  But then the actual command that get's executed, the "$1" has been evaluated away.</p>
  
  <p>In fact, even the following Makefile fails, when properly escaping the dollar-sign with a double-dollar-sign.  Of course I want to write a recipe that doesn't hard-code the filenames, but the files should be found with the $(shell find ...) command</p>
  
  <blockquote>
  <pre><code>default:
      hexdump subdir/abc$$1.class xyz.class
  </code></pre>
  </blockquote>
  
  <p>Even the above Makefile fails with the same error as the first Makefile.</p>
  
  <p>How can I stop GNU make from interfering with my filenames that contain dollar-signs?  The java compiler creates these things all the time, so surely someone must have run into this before?</p>